PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: bombsimon/wsl (go)

Issue:
Allow defer statements after error checking
It is good practice to defer a close statement for a HTTP response body after the error check as discussed in https://stackoverflow.com/questions/33238518/what-could-happen-if-i-dont-close-response-body-in-golang#33238755

In my opinion, this defer statement should logically be part of the block where the body originates so I think we should allow the following:

```go
resp, err := client.Do(req)
if err != nil {
    return err
}
defer resp.Body.Close()
```

instead of enforcing the following:

```go
resp, err := client.Do(req)
if err != nil {
    return err
}

defer resp.Body.Close()
```

Pull request:
Support cuddle http body close with error check
This resolves #31 

The implementation is **very** specific to this use case but I imagine this is the only way not already allowed which should be supported. If there are more cases needed to handle this we can add them later!

Patch:
diff --git a/wsl.go b/wsl.go
index 696ca6b..9bc0fe2 100644
--- a/wsl.go
+++ b/wsl.go
@@ -414,6 +414,25 @@ func (p *Processor) parseBlockStatements(statements []ast.Stmt) {
 				continue
 			}
 
+			// Special treatment of deferring body closes after error checking
+			// according to best practices. See
+			// https://github.com/bombsimon/wsl/issues/31 which links to
+			// discussion about error handling after HTTP requests. This is hard
+			// coded and very specific but for now this is to be seen as a
+			// special case. What this does is that it *only* allows a defer
+			// statement with `Close` on the right hand side to be cuddled with
+			// an if-statement to support this:
+			//  resp, err := client.Do(req)
+			//  if err != nil {
+			//      return err
+			//  }
+			//  defer resp.Body.Close()
+			if _, ok := previousStatement.(*ast.IfStmt); ok {
+				if atLeastOneInListsMatch(rightHandSide, []string{"Close"}) {
+					continue
+				}
+			}
+
 			if moreThanOneStatementAbove() {
 				p.addError(t.Pos(), "only one cuddle assignment allowed before defer statement")
 


Test patch:
diff --git a/wsl_test.go b/wsl_test.go
index f509d18..dcd2927 100644
--- a/wsl_test.go
+++ b/wsl_test.go
@@ -1055,6 +1055,18 @@ func TestShouldAddEmptyLines(t *testing.T) {
 				"block should not end with a whitespace (or comment)",
 			},
 		},
+		{
+			description: "allow http body close best practice",
+			code: []byte(`package main
+
+			func main() {
+				resp, err := client.Do(req)
+				if err != nil {
+					return err
+				}
+				defer resp.Body.Close()
+			}`),
+		},
 	}
 
 	for _, tc := range cases {
Repository: validatorjs/validator.js (js)

Issue:
Add stricter Ecuador phone number validation
Following the comments on #1187, certain digit combinations are not valid. According to the [ITU document about Ecuador National Numbering plans](https://www.itu.int/dms_pub/itu-t/oth/02/02/T020200003D0001PDFE.pdf) there are a couple of missing rules:

- 9 digits numbers are only valid if the first digit is 9.
- Cellphone numbers start with a network code between 92 and 99, so cellphone numbers starting with 90 and 91 are invalid

A PR is coming shorty to address this issue.


Pull request:
Enforce stricter Ecuador phone number validation
This will enforce stricter Ecuador phone number validation. @tux-tn
Closes #1190

Patch:
diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js
index 7b4f046..2e5d7a7 100644
--- a/src/lib/isMobilePhone.js
+++ b/src/lib/isMobilePhone.js
@@ -41,7 +41,7 @@ const phones = {
   'en-ZA': /^(\+?27|0)\d{9}$/,
   'en-ZM': /^(\+?26)?09[567]\d{7}$/,
   'es-CL': /^(\+?56|0)[2-9]\d{1}\d{7}$/,
-  'es-EC': /^(\+?593|0)[2-7,9]\d{7,8}$/,
+  'es-EC': /^(\+?593|0)([2-7]|9[2-9])\d{7}$/,
   'es-ES': /^(\+?34)?(6\d{1}|7[1234])\d{7}$/,
   'es-MX': /^(\+?52)?(1|01)?\d{10,11}$/,
   'es-PA': /^(\+?507)\d{7,8}$/,


Test patch:
diff --git a/test/validators.js b/test/validators.js
index f78edf9..8ac0e9f 100644
--- a/test/validators.js
+++ b/test/validators.js
@@ -4644,10 +4644,11 @@ describe('Validators', () => {
       {
         locale: 'es-EC',
         valid: [
-          '+593995414585',
-          '593912345677',
-          '0915114585',
+          '+593987654321',
+          '593987654321',
+          '0987654321',
           '027332615',
+          '+59323456789',
         ],
         invalid: [
           '03321321',
@@ -4656,6 +4657,10 @@ describe('Validators', () => {
           '02344635',
           '593123456789',
           '081234567',
+          '+593912345678',
+          '+593902345678',
+          '+593287654321',
+          '593287654321',
         ],
       },
       {