nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: bombsimon/wsl
Pull request #68 (2020-02-05 16:15:11)

Error check enforcement: Support inline initialization
Ran this against a large codebase at work this morning and the inline err-check false-positives are resolved. No more false positives, and our code looks beautiful!!

After I got this working I felt that the code was getting too nested, so I pulled the logic for this fix into a closure, LMK if you think there's a better place for that to be defined, or you would prefer the nesting instead of the closure. :)

Fixes false-positive reported in #65 

coveralls: ## Pull Request Test Coverage Report for [Build 167](https://coveralls.io/builds/28547149)

* **12** of **12**   **(100.0%)**  changed or added relevant lines in **1** file are covered.
* No unchanged relevant lines lost coverage.
* Overall coverage increased (+**0.2%**) to **89.514%**

---



|  Totals | [![Coverage Status](https://coveralls.io/builds/28547149/badge)](https://coveralls.io/builds/28547149) |
| :-- | --: |
| Change from base [Build 166](https://coveralls.io/builds/28507782): |  0.2% |
| Covered Lines: | 589 |
| Relevant Lines: | 658 |

---
##### 💛  - [Coveralls](https://coveralls.io)

bombsimon: Thanks again for this, super excited to see other people engaged in this linter. 😄 
JDiPierro: Great suggestions, thanks for the feedback! I was super excited when I found out that this linter existed, so thanks for putting in the effort to build it! :D 
JDiPierro: CI failed with a strange error:

```
	fatal: unable to access 'https://github.com/pmezard/go-difflib/': Failed to connect to github.com port 443: Connection timed out
go: error loading module requirements
The command "go get -v golang.org/x/tools/cmd/cover github.com/mattn/goveralls" failed and exited with 1 during .
```

Is there a way to kick off a retry without another commit?
bombsimon: All checks green, this looks great! 🚢 

Patch:
diff --git a/wsl.go b/wsl.go
index 154df64..51f8870 100644
--- a/wsl.go
+++ b/wsl.go
@@ -374,9 +374,23 @@ func (p *Processor) parseBlockStatements(statements []ast.Stmt) {
 
 		switch t := stmt.(type) {
 		case *ast.IfStmt:
+			checkingErrInitializedInline := func() bool {
+				if t.Init == nil {
+					return false
+				}
+
+				// Variables were initialized inline in the if statement
+				// Let's make sure it's the err just to be safe
+				return atLeastOneInListsMatch(p.findLHS(t.Init), p.config.ErrorVariableNames)
+			}
+
 			if !cuddledWithLastStmt {
 				checkingErr := atLeastOneInListsMatch(rightAndLeftHandSide, p.config.ErrorVariableNames)
 				if checkingErr {
+					if checkingErrInitializedInline() {
+						continue
+					}
+
 					if atLeastOneInListsMatch(assignedOnLineAbove, p.config.ErrorVariableNames) {
 						p.addError(t.Pos(), reasonMustCuddleErrCheck)
 					}


Test patch:
diff --git a/wsl_test.go b/wsl_test.go
index e4aaddf..8596acd 100644
--- a/wsl_test.go
+++ b/wsl_test.go
@@ -1613,6 +1613,10 @@ func TestWithConfig(t *testing.T) {
 					return nil
 				}
 
+				if err := ProduceError(); err != nil {
+					return err
+				}
+
 				return baz
 			}`),
 			expectedErrorStrings: []string{},