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

Issue:
Expressions can be cuddled with `for` blocks, but not with `if` blocks
![image](https://github.com/bombsimon/wsl/assets/31022056/2eab8c10-774a-4001-9d41-a02494c8e0f2)

**Repro**:

```go
for i := 0; i < 4; i++ {
	fmt.Println()
}
Up(3)

if autoheight != 3 {
	t.Errorf("height should be 3 but is %d", autoheight)
}
Down(3)
```

**wsl command used**: `wsl ./...`
![image](https://github.com/bombsimon/wsl/assets/31022056/bd2a5214-1ec1-4f72-8f24-aecda57099cd)

**wsl -V=full**: `/home/main/go/bin/wsl version devel comments-go-here buildID=e631328272005e19fcb7774191f8cc3535d896a2a0ff3946a982e95dc9b3736c`

**GOOS**: Arch Linux
**GOARCH**: `amd64`

## Expected behaviour

Expressions cannot be cuddled with either `for` nor `if` blocks.

Pull request:
Fix missing expression cuddle check
Resolves #153 

Patch:
diff --git a/wsl.go b/wsl.go
index 0b8d8c0..76f4abf 100644
--- a/wsl.go
+++ b/wsl.go
@@ -583,7 +583,7 @@ func (p *processor) parseBlockStatements(statements []ast.Stmt) {
 				}
 
 				p.addWhitespaceBeforeError(t, reasonExpressionCuddledWithDeclOrRet)
-			case *ast.IfStmt, *ast.RangeStmt, *ast.SwitchStmt:
+			case *ast.IfStmt, *ast.RangeStmt, *ast.SwitchStmt, *ast.TypeSwitchStmt, *ast.ForStmt:
 				p.addWhitespaceBeforeError(t, reasonExpressionCuddledWithBlock)
 			}
 


Test patch:
diff --git a/testdata/src/default_config/generic_handling.go b/testdata/src/default_config/generic_handling.go
index 89490eb..204d71d 100644
--- a/testdata/src/default_config/generic_handling.go
+++ b/testdata/src/default_config/generic_handling.go
@@ -592,3 +592,16 @@ func AnonymousFunc() {
 		return nil // want "return statements should not be cuddled if block has more than two lines"
 	}())
 }
+
+// Issue #153
+func ExpressionForBlock() {
+	for i := 0; i < 4; i++ {
+		fmt.Println()
+	}
+	Up(3) // want "expressions should not be cuddled with blocks"
+
+	if autoheight != 3 {
+		t.Errorf("height should be 3 but is %d", autoheight)
+	}
+	Down(3) // want "expressions should not be cuddled with blocks"
+}
diff --git a/testdata/src/default_config/generic_handling.go.golden b/testdata/src/default_config/generic_handling.go.golden
index 8c6f585..86bd161 100644
--- a/testdata/src/default_config/generic_handling.go.golden
+++ b/testdata/src/default_config/generic_handling.go.golden
@@ -639,3 +639,18 @@ func AnonymousFunc() {
 		return nil // want "return statements should not be cuddled if block has more than two lines"
 	}())
 }
+
+// Issue #153
+func ExpressionForBlock() {
+	for i := 0; i < 4; i++ {
+		fmt.Println()
+	}
+
+	Up(3) // want "expressions should not be cuddled with blocks"
+
+	if autoheight != 3 {
+		t.Errorf("height should be 3 but is %d", autoheight)
+	}
+
+	Down(3) // want "expressions should not be cuddled with blocks"
+}
Repository: protofire/solhint (js)

Issue:
Better error when config file doesn't exist
When `.solhint.json` doesn't exist, or when the file passed with `-c` doesn't exist, the thrown error is:

```
Cannot read property 'config' of null
```

which is not very descriptive. Plus, the exit code is 0 instead of being non-zero.

Pull request:
Better error when config file doesn't exist
Closes #125 

- Exit code with -1 when .solhint.json doesn't exist
- Improve message when cannot read property 'config' of null, throw a custom error

Patch:
diff --git a/lib/common/errors.js b/lib/common/errors.js
index 6606aad..2c63d0d 100644
--- a/lib/common/errors.js
+++ b/lib/common/errors.js
@@ -1,6 +1,7 @@
 class ConfigMissingError extends Error {
   constructor(configName) {
-    const message = `Failed to load config "${configName}" to extend from.`
+    let message = `Failed to load a solhint's config file.`
+    if (configName) message = `Failed to load config "${configName}" to extend from.`
     super(message)
   }
 }
diff --git a/lib/config/config-file.js b/lib/config/config-file.js
index 9c5e366..40c3426 100644
--- a/lib/config/config-file.js
+++ b/lib/config/config-file.js
@@ -49,6 +49,9 @@ const loadConfig = () => {
 
   const explorer = cosmiconfig(moduleName, cosmiconfigOptions)
   const searchedFor = explorer.searchSync(appDirectory)
+  if (!searchedFor) {
+    throw new ConfigMissingError()
+  }
   return searchedFor.config || createEmptyConfig()
 }
 
diff --git a/solhint.js b/solhint.js
index 14f8736..99b1b0a 100755
--- a/solhint.js
+++ b/solhint.js
@@ -128,7 +128,7 @@ const readConfig = _.memoize(() => {
     config = loadConfig()
   } catch (e) {
     console.log(e.message)
-    process.exit(0)
+    process.exit(1)
   }
 
   const configExcludeFiles = _.flatten(config.excludedFiles)


Test patch:
diff --git a/test/common/errors.js b/test/common/errors.js
new file mode 100644
index 0000000..f1d806e
--- /dev/null
+++ b/test/common/errors.js
@@ -0,0 +1,22 @@
+const assert = require('assert')
+const { ConfigMissingError } = require('./../../lib/common/errors')
+
+describe('errors', () => {
+  it('should throw a ConfigMissingError and match the message', () => {
+    const ThrowError = () => {
+      throw new ConfigMissingError('config_example.json')
+    }
+
+    assert.throws(ThrowError, ConfigMissingError)
+    assert.throws(ThrowError, /Failed to load config "config_example.json" to extend from.$/)
+  })
+
+  it('should throw a ConfigMissingError and match the default message', () => {
+    const ThrowError = () => {
+      throw new ConfigMissingError()
+    }
+
+    assert.throws(ThrowError, ConfigMissingError)
+    assert.throws(ThrowError, /Failed to load a solhint's config file.$/)
+  })
+})
Repository: maizzle/framework (js)

Issue:
Six-digit HEX transformer applies to text content
- Maizzle Version: 3.7.3
- Node.js Version: 15.14.0

The [Six-digit HEX](https://maizzle.com/docs/code-cleanup/#six-digit-hex) transformer erroneously applies to text content inside HTML. For example, inside a template, the following content:

```
<h1>Welcome to issue #123 or our newsletter!</h1>
```

…is turned into:

```
<h1>Welcome to issue #112233 or our newsletter!</h1>
```

Setting `sixHex:false` in the config solves this (but turns this off which might be unfortunate for those who need it). 

Pull request:
refactor: sixhex transformer
This PR fixes an issue with the sixHex transformer that was causing HEX codes from text content to be expanded from 3 to 6 digits.

Fixes #668 


Patch:
diff --git a/src/transformers/sixHex.js b/src/transformers/sixHex.js
index e954dff..74d638d 100644
--- a/src/transformers/sixHex.js
+++ b/src/transformers/sixHex.js
@@ -1,4 +1,6 @@
 const {get} = require('lodash')
+const posthtml = require('posthtml')
+const parseAttrs = require('posthtml-attrs-parser')
 const {conv} = require('color-shorthand-hex-to-six-digit')
 
 module.exports = async (html, config = {}) => {
@@ -6,5 +8,26 @@ module.exports = async (html, config = {}) => {
     return html
   }
 
-  return conv(html)
+  const posthtmlOptions = get(config, 'build.posthtml.options', {})
+  return posthtml([sixHex()]).process(html, posthtmlOptions).then(result => result.html)
+}
+
+const sixHex = () => tree => {
+  const process = node => {
+    const attrs = parseAttrs(node.attrs)
+
+    const targets = ['bgcolor', 'color']
+
+    targets.forEach(attribute => {
+      if (attrs[attribute]) {
+        attrs[attribute] = conv(attrs[attribute])
+      }
+    })
+
+    node.attrs = attrs.compose()
+
+    return node
+  }
+
+  return tree.walk(process)
 }


Test patch:
diff --git a/test/test-transformers.js b/test/test-transformers.js
index b64606e..bad2a9e 100644
--- a/test/test-transformers.js
+++ b/test/test-transformers.js
@@ -261,15 +261,25 @@ test('safe class names (disabled)', async t => {
 })
 
 test('six digit hex', async t => {
-  const html = await Maizzle.ensureSixHEX('<td style="color: #ffc" bgcolor="#000"></td>')
-
-  t.is(html, '<td style="color: #ffffcc" bgcolor="#000000"></td>');
+  const html = await Maizzle.ensureSixHEX(
+    `
+<div bgcolor="#000" style="color: #fff; background-color: #000">This should not change: #ffc</div>
+<font color="#fff">Text</font>
+    `)
+
+  t.is(
+    html.trim(),
+    `
+<div bgcolor="#000000" style="color: #fff; background-color: #000">This should not change: #ffc</div>
+<font color="#ffffff">Text</font>
+    `.trim()
+  )
 })
 
 test('six digit hex (disabled)', async t => {
   const html = await Maizzle.ensureSixHEX('<td style="color: #ffc" bgcolor="#000"></td>', {sixHex: false})
 
-  t.is(html, '<td style="color: #ffc" bgcolor="#000"></td>');
+  t.is(html, '<td style="color: #ffc" bgcolor="#000"></td>')
 })
 
 test('transform contents (javascript)', async t => {
Repository: stretchr/testify (go)

Issue:
time.Time comparison produces non-helpful diff
https://github.com/stretchr/testify/pull/895 broke diffs with time.Time:

In 1.5.1:
``` diff
-    Created: (xxx.Time) 2020-01-14T06:23:58Z,
-    Modified: (xxx.Time) 2020-01-14T06:23:58Z,
+    Created: (xxx.Time) 2018-08-05T09:30:53Z,
+    Modified: (xxx.Time) 2019-04-11T04:28:50Z,
```

In 1.6.1:
```diff
@@ -13,3 +13,3 @@
        wall: (uint64) 0,
-      ext: (int64) 63714579838,
+      ext: (int64) 63669058253,
        loc: (*time.Location)(<nil>)
@@ -20,3 +20,3 @@
        wall: (uint64) 0,
-      ext: (int64) 63714579838,
+      ext: (int64) 63690553730,
        loc: (*time.Location)(<nil>)
```


Pull request:
Make sure time.Time comparison produces a helpful diff. closes #989
Make sure time.Time comparison produces a helpful diff. closes #989


## Summary
Make sure time.Time comparison produces a helpful diff
again. This partially reverses the changes in #895 for
time.Time and allows it to be easily expanded for more
types in the future if needed.

## Changes
Analyzes the type when diffing, and uses a different
Spew config for time.Time

Introduce a test for diffing time.Time

## Motivation
See bug #989

## Related issues
Closes #989 

Patch:
diff --git a/assert/assertions.go b/assert/assertions.go
index 00d97a5..6882692 100644
--- a/assert/assertions.go
+++ b/assert/assertions.go
@@ -1609,12 +1609,17 @@ func diff(expected interface{}, actual interface{}) string {
 	}
 
 	var e, a string
-	if et != reflect.TypeOf("") {
-		e = spewConfig.Sdump(expected)
-		a = spewConfig.Sdump(actual)
-	} else {
+
+	switch et {
+	case reflect.TypeOf(""):
 		e = reflect.ValueOf(expected).String()
 		a = reflect.ValueOf(actual).String()
+	case reflect.TypeOf(time.Time{}):
+		e = spewConfigStringerEnabled.Sdump(expected)
+		a = spewConfigStringerEnabled.Sdump(actual)
+	default:
+		e = spewConfig.Sdump(expected)
+		a = spewConfig.Sdump(actual)
 	}
 
 	diff, _ := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{
@@ -1646,6 +1651,14 @@ var spewConfig = spew.ConfigState{
 	MaxDepth:                10,
 }
 
+var spewConfigStringerEnabled = spew.ConfigState{
+	Indent:                  " ",
+	DisablePointerAddresses: true,
+	DisableCapacities:       true,
+	SortKeys:                true,
+	MaxDepth:                10,
+}
+
 type tHelper interface {
 	Helper()
 }


Test patch:
diff --git a/assert/assertions_test.go b/assert/assertions_test.go
index 3bd418d..1350567 100644
--- a/assert/assertions_test.go
+++ b/assert/assertions_test.go
@@ -1991,6 +1991,23 @@ Diff:
 		diffTestingStruct{A: "some string", B: 15},
 	)
 	Equal(t, expected, actual)
+
+	expected = `
+
+Diff:
+--- Expected
++++ Actual
+@@ -1,2 +1,2 @@
+-(time.Time) 2020-09-24 00:00:00 +0000 UTC
++(time.Time) 2020-09-25 00:00:00 +0000 UTC
+ 
+`
+
+	actual = diff(
+		time.Date(2020, 9, 24, 0, 0, 0, 0, time.UTC),
+		time.Date(2020, 9, 25, 0, 0, 0, 0, time.UTC),
+	)
+	Equal(t, expected, actual)
 }
 
 func TestTimeEqualityErrorFormatting(t *testing.T) {