Repository: editorconfig-checker/editorconfig-checker
Pull request #468 (2025-05-09 11:16:01)

Update default excludes config.go to include Golang go.work and go.work.sum
Per this discussion https://github.com/editorconfig/editorconfig-core-go/pull/210#discussion_r2075830931 and suggestion from @generalmimon 

This updates the default https://github.com/editorconfig-checker/editorconfig-checker/tree/f1ae05b9aee4fd6404a398687cb05cf1d8df4158?tab=readme-ov-file#default-excludes

> 
> > Linting with [editorconfig-checker](https://github.com/editorconfig-checker/editorconfig-checker) (or [super-linter](https://github.com/super-linter/super-linter) which uses that) complained about our `go.work` and `go.work.sum`) lead me here.
> 
> If you're looking for a solution for [editorconfig-checker](https://github.com/editorconfig-checker/editorconfig-checker) specifically, I think the right way would be to make a pull request that adds `go.work{,.sum}` to `defaultExcludes`. The `go.{mod,sum}` files are already there, so it makes a lot of sense:
> 
> [`config.go:19-23`](https://github.com/editorconfig-checker/editorconfig-checker/blob/f1ae05b9aee4fd6404a398687cb05cf1d8df4158/pkg/config/config.go#L19-L23)
> 
> ```go
> // DefaultExcludes is the regular expression for ignored files
> var DefaultExcludes = strings.Join(defaultExcludes, "|")
> 
> // defaultExcludes are an array to produce the correct string from
> var defaultExcludes = []string{
> ```
> 
> [`config.go:34-35`](https://github.com/editorconfig-checker/editorconfig-checker/blob/f1ae05b9aee4fd6404a398687cb05cf1d8df4158/pkg/config/config.go#L34-L35)
> 
> ```go
> 	// Go Modules (Go)
> 	"go\\.(mod|sum)$",
> ```
> 
> These "default excludes" are also mentioned in the README: [**editorconfig-checker** / Default Excludes](https://github.com/editorconfig-checker/editorconfig-checker/tree/f1ae05b9aee4fd6404a398687cb05cf1d8df4158?tab=readme-ov-file#default-excludes)


ccoVeille: Please fix:
- the link in your PR description
- unit tests
generalmimon: @ccoVeille:

> * unit tests

Yes, and I suppose the `README.md` should be updated too. [#324](https://github.com/editorconfig-checker/editorconfig-checker/pull/324/files) looks like a good PR for inspiration on how it should look.
StevenACoffman: Thanks! I think I have it updated now.
codecov[bot]: ## [Codecov](https://app.codecov.io/gh/editorconfig-checker/editorconfig-checker/pull/468?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=editorconfig-checker) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 87.59%. Comparing base [(`af09b21`)](https://app.codecov.io/gh/editorconfig-checker/editorconfig-checker/commit/af09b21a62b83bbc8060533f9dc8ff746c57fc6f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=editorconfig-checker) to head [(`b8faadf`)](https://app.codecov.io/gh/editorconfig-checker/editorconfig-checker/commit/b8faadfe274b8a1ea7a8cf3be7171ececf3099e3?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=editorconfig-checker).
> Report is 52 commits behind head on main.

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##             main     #468      +/-   ##
==========================================
+ Coverage   86.72%   87.59%   +0.86%     
==========================================
  Files          11       11              
  Lines        1017     1048      +31     
==========================================
+ Hits          882      918      +36     
+ Misses        102       99       -3     
+ Partials       33       31       -2     
```

</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/editorconfig-checker/editorconfig-checker/pull/468?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=editorconfig-checker).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=editorconfig-checker).

<details><summary> :rocket: New features to boost your workflow: </summary>

- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
ccoVeille: Tests are OK, but you need to update the commits message to comply with lint-commit action
StevenACoffman: Ok, I `git reset --soft` to the last common commit, and re-commit using the commit from the example PR but updated to have the relevant file names.
StevenACoffman: > Thanks for this
Ha, this was nothing. Thank *you all* for *this* project (and a bunch more)! 

Patch:
diff --git a/README.md b/README.md
index 88f04e8..c3dcb0c 100644
--- a/README.md
+++ b/README.md
@@ -301,7 +301,7 @@ If you choose to [ignore them](#ignoring-default-excludes), these paths are excl
 // RubyGems (Ruby)
 "Gemfile\\.lock$",
 // Go Modules (Go)
-"go\\.(mod|sum)$",
+"go\\.(mod|sum|work|work\\.sum)$",
 // Gradle (Java)
 "gradle/wrapper/gradle-wrapper\\.properties$",
 "gradlew(\\.bat)?$",
diff --git a/pkg/config/config.go b/pkg/config/config.go
index 3e82c2e..cab9198 100644
--- a/pkg/config/config.go
+++ b/pkg/config/config.go
@@ -32,7 +32,7 @@ var defaultExcludes = []string{
 	// RubyGems (Ruby)
 	"Gemfile\\.lock$",
 	// Go Modules (Go)
-	"go\\.(mod|sum)$",
+	"go\\.(mod|sum|work|work\\.sum)$",
 	// Gradle (Java)
 	"gradle/wrapper/gradle-wrapper\\.properties$",
 	"gradlew(\\.bat)?$",


Test patch:
diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go
index 60ddc5b..3837ac2 100644
--- a/pkg/config/config_test.go
+++ b/pkg/config/config_test.go
@@ -86,7 +86,7 @@ func TestGetExcludesAsRegularExpression(t *testing.T) {
 	}
 
 	actual = c.GetExcludesAsRegularExpression()
-	expected = `testfiles|testdata|\.git/|\.jj/|Cargo\.lock$|composer\.lock$|Gemfile\.lock$|go\.(mod|sum)$|gradle/wrapper/gradle-wrapper\.properties$|gradlew(\.bat)?$|(buildscript-)?gradle\.lockfile?$|\.mvn/wrapper/maven-wrapper\.properties$|\.mvn/wrapper/MavenWrapperDownloader\.java$|mvnw(\.cmd)?$|/node_modules/|npm-shrinkwrap\.json$|package-lock\.json$|Pipfile\.lock$|poetry\.lock$|pnpm-lock\.yaml$|\.terraform\.lock\.hcl$|uv\.lock$|\.pnp\.c?js$|\.pnp\.loader\.mjs$|\.yarn/|yarn\.lock$|\.eot$|\.otf$|\.ttf$|\.woff2?$|\.avif$|\.gif$|\.ico$|\.jpe?g$|\.mp4$|\.p[bgnp]m$|\.png$|\.svg$|\.tiff?$|\.webp$|\.wmv$|\.bak$|\.bin$|\.docx?$|\.exe$|\.pdf$|\.snap$|\.xlsx?$|\.7z$|\.bz2$|\.gz$|\.jar$|\.tar$|\.tgz$|\.war$|\.zip$|\.log$|\.patch$|\.(css|js)\.map$|min\.(css|js)$`
+	expected = `testfiles|testdata|\.git/|\.jj/|Cargo\.lock$|composer\.lock$|Gemfile\.lock$|go\.(mod|sum|work|work\.sum)$|gradle/wrapper/gradle-wrapper\.properties$|gradlew(\.bat)?$|(buildscript-)?gradle\.lockfile?$|\.mvn/wrapper/maven-wrapper\.properties$|\.mvn/wrapper/MavenWrapperDownloader\.java$|mvnw(\.cmd)?$|/node_modules/|npm-shrinkwrap\.json$|package-lock\.json$|Pipfile\.lock$|poetry\.lock$|pnpm-lock\.yaml$|\.terraform\.lock\.hcl$|uv\.lock$|\.pnp\.c?js$|\.pnp\.loader\.mjs$|\.yarn/|yarn\.lock$|\.eot$|\.otf$|\.ttf$|\.woff2?$|\.avif$|\.gif$|\.ico$|\.jpe?g$|\.mp4$|\.p[bgnp]m$|\.png$|\.svg$|\.tiff?$|\.webp$|\.wmv$|\.bak$|\.bin$|\.docx?$|\.exe$|\.pdf$|\.snap$|\.xlsx?$|\.7z$|\.bz2$|\.gz$|\.jar$|\.tar$|\.tgz$|\.war$|\.zip$|\.log$|\.patch$|\.(css|js)\.map$|min\.(css|js)$`
 
 	if actual != expected {
 		t.Errorf("expected %s, got %s", expected, actual)