-
Notifications
You must be signed in to change notification settings - Fork 519
CI: migrate to golangci-lint v2 #6473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
89fcd8e
output of migration command
cce 218ce0e
add back comments
cce 5c04963
consolidate paralleltest exclusion
cce f3c833e
exclusions
cce 6f35d5d
warning linter comments
cce dd4175d
update github actions and custom linter
cce f30696f
use golangci-lint v2 module plugin system
cce d9da0ef
update warning linter config
cce 954778d
fix linter
cce 8c6ce95
fix missing partitiontest warnings
cce 764717f
fix gosec warnings
cce 74a2569
update scripts/buildtools/versions
cce fcfe79a
fix gosec error
cce f5c2b5a
clean up linter exclusions list
cce ce4db74
simplify staticcheck config
cce dd10b6f
clean up golangci.yml more
cce File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| version: v2.5.0 | ||
| name: custom-golangci-lint | ||
| plugins: | ||
| # partitiontest plugin from local source | ||
| - module: 'github.com/algorand/go-algorand/cmd/partitiontest_linter' | ||
| path: ./cmd/partitiontest_linter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,66 +1,35 @@ | ||
| version: "2" | ||
| run: | ||
| timeout: 5m | ||
| tests: true | ||
|
|
||
| linters: | ||
| disable-all: true | ||
| default: none | ||
| enable: | ||
| - gosec | ||
| - partitiontest | ||
|
|
||
| linters-settings: | ||
| gosec: # Go 1.22 makes G601 irrelevant | ||
| excludes: [G101, G103, G104, G107, G115, G202, G301, G302, G303, G304, G306, G307, G404, G601] | ||
| custom: | ||
| partitiontest: | ||
| path: cmd/partitiontest_linter/plugin.so | ||
| description: This custom linter checks files that end in '_test.go', specifically functions that start with 'Test' and have testing argument, for a line 'partitiontest.ParitionTest(<testing arg>)' | ||
| original-url: github.com/algorand/go-algorand/cmd/partitiontest_linter | ||
|
|
||
| severity: | ||
| default-severity: warning | ||
|
|
||
| settings: | ||
| gosec: | ||
| excludes: [G101, G103, G104, G107, G112, G114, G115, G202, G204, G301, G302, G303, G304, G306, G307, G404] | ||
| custom: | ||
| partitiontest: | ||
| type: "module" | ||
| description: This custom linter ensures test functions call 'partitiontest.PartitionTest(t)' | ||
| exclusions: | ||
| generated: lax | ||
| rules: | ||
| # be more lenient with test code | ||
| - linters: | ||
| - gosec | ||
| path: _test\.go | ||
| - linters: | ||
| - partitiontest | ||
| path: crypto/secp256k1/secp256_test\.go | ||
| issues: | ||
| # use these new lint checks on code since #2574 | ||
| new-from-rev: eb019291beed556ec6ac1ceb4a15114ce4df0c57 | ||
|
|
||
| # Disable default exclude rules listed in `golangci-lint run --help` (selectively re-enable some below) | ||
| exclude-use-default: false | ||
|
|
||
| # Maximum issues count per one linter. Set to 0 to disable. Default is 50. | ||
| max-issues-per-linter: 0 | ||
|
|
||
| # Maximum count of issues with the same text. Set to 0 to disable. Default is 3. | ||
| max-same-issues: 0 | ||
|
|
||
| exclude: | ||
| # ignore govet false positive fixed in https://github.com/golang/go/issues/45043 | ||
| - "sigchanyzer: misuse of unbuffered os.Signal channel as argument to signal.Notify" | ||
| # ignore issues about the way we use _struct fields to define encoding settings | ||
| - "`_struct` is unused" | ||
|
|
||
| # Enable some golangci-lint default exception rules: | ||
| # "EXC0001 errcheck: Almost all programs ignore errors on these functions and in most cases it's ok" | ||
| - Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked | ||
| # "EXC0005 staticcheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore" | ||
| - ineffective break statement. Did you mean to break out of the outer loop | ||
|
|
||
| exclude-rules: | ||
| # be more lenient with test code | ||
| - path: _test\.go | ||
| linters: | ||
| - deadcode | ||
| - gosec | ||
| - structcheck | ||
| - varcheck | ||
| - unused | ||
| # Add all linters here -- Comment this block out for testing linters | ||
| - path: test/linttest/lintissues\.go | ||
| linters: | ||
| - deadcode | ||
| - structcheck | ||
| - varcheck | ||
| - unused | ||
| - path: crypto/secp256k1/secp256_test\.go | ||
| linters: | ||
| - partitiontest | ||
| severity: | ||
| default: warning | ||
| formatters: | ||
| exclusions: | ||
| generated: lax |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.