-
Notifications
You must be signed in to change notification settings - Fork 179
chore: migrate to golangci-lint v2 #4769
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
36 commits
Select commit
Hold shift + click to select a range
1c51cb3
chore: migrate to golangci-lint v2
romshark 9902bf1
fix: use v2 module
romshark 9ee0372
fix: move deprecated flags to yaml config
romshark ccebfbf
refactor: remove embedded fields in selectors
romshark 22c1a65
refactor: uncapitalize error messages
romshark 2c009b0
refactor: simplify code using De Morgan's law
romshark fbefa22
refactor: remove underscore receivers
romshark be61460
refactor: use strings.ReplaceAll (QF1004)
romshark 9f05f89
refactor: replace if-else with switch (QF1003)
romshark 2f3f874
Merge branch 'master' into chore-golangci-lint-v2
romshark 4d9c1c6
refactor: remove unused
romshark b1be505
refactor: punctuation in errors (ST1005)
romshark 2bf1881
refactor: remove redundant imports (ST1019)
romshark 66dc678
refactor: simplify code (QF1006)
romshark cdc0731
refactor: simplify code (ST1023)
romshark 03ac089
refactor: simplify code (QF1009)
romshark 4f7c56f
refactor: return error last (ST1008)
romshark e58573a
refactor: untyped constants (SA9004)
romshark df48429
refactor: replace deprecated method (SA1019)
romshark 69e52dc
doc: ignore deprecated method in test (SA1019)
romshark 4362e6b
refactor: replace deprecated method
romshark ddd8d4b
Merge branch 'master' into chore-golangci-lint-v2
romshark 2d1f66d
fix: exlude SA1019 for deprecated grpc APIs
romshark 33f780c
fix: ignore SA1019 for bazel.Runfile
romshark caac21e
fix: ignore SA1019 for periodic.Start
romshark a85d803
chore: Fix lines too long
romshark 8ff3f00
fix: ignore SA1019 for elliptic.Marshal
romshark 0d83fe7
fix: expect typed int in test
romshark 9ec177d
Merge branch 'master' into chore-golangci-lint-v2
romshark 779e2a4
chore: run make all
romshark 71e0f19
chore: reconfigure staticcheck
romshark 19f7502
refactor: Simplify boolean expression
romshark 990ce59
Revert "refactor: remove embedded fields in selectors"
romshark 735de53
fix: disable QF1008 in staticcheck
romshark 06a1bcd
Merge branch 'master' into chore-golangci-lint-v2
romshark c2bba7d
docs: remove accidental tabulator in yaml
romshark 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,111 @@ | ||
| version: "2" | ||
| run: | ||
| skip-dirs: | ||
| - ^doc/ | ||
| timeout: 3m | ||
| linters: | ||
| default: none | ||
| enable: | ||
| - contextcheck | ||
| - copyloopvar | ||
| - errcheck | ||
| - forbidigo | ||
| - goheader | ||
| - govet | ||
| - ineffassign | ||
| - lll | ||
| - misspell | ||
| - rowserrcheck | ||
| - sqlclosecheck | ||
| - staticcheck | ||
| - unconvert | ||
| - unused | ||
| settings: | ||
| staticcheck: | ||
| checks: | ||
| - all | ||
| - "-QF1001" # disable "Apply De Morgan's law". | ||
| # The use of Go ideomatic identifiers is a recommendation, not a law. | ||
| - "-ST1003" # disable "Poorly chosen identifier". | ||
| - "-QF1008" # disable "Omit embedded fields from selector expression". | ||
| errcheck: | ||
| exclude-functions: | ||
| - (*github.com/spf13/cobra.Command).MarkFlagRequired | ||
| forbidigo: | ||
| forbid: | ||
| - pattern: ([iI][fF][iI]d)|([iI]F[iI][dD])|([iI][fF]i[dD]) | ||
| msg: spell interface ID as ifID / IfID | ||
| - pattern: (?i)interfaceID | ||
| msg: spell interface ID as ifID / IfID | ||
| - pattern: Trc | ||
| msg: spell trust root certificate as trc / TRC | ||
| goheader: | ||
| values: | ||
| regexp: | ||
| copyright-lines: |- | ||
| (Copyright 20[0-9][0-9] .*)( | ||
| Copyright 20[0-9][0-9] .*)* | ||
| template: |- | ||
| {{copyright-lines}} | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| lll: | ||
| line-length: 100 | ||
| tab-width: 4 | ||
| exclusions: | ||
| generated: lax | ||
| presets: | ||
| - comments | ||
| - common-false-positives | ||
| - legacy | ||
| - std-error-handling | ||
| rules: | ||
| - linters: | ||
| - lll | ||
| source: http[s]://\S{80,}$ | ||
| - linters: | ||
| - lll | ||
| source: '`(yaml|toml|json):"[^`]*`$' | ||
| - linters: | ||
| - goheader | ||
| path: pkg/private/util/duration.go | ||
| - linters: | ||
| - errcheck | ||
| - goheader | ||
| path: pkg/private/serrors/stack.go | ||
| - linters: | ||
| - errcheck | ||
| - goheader | ||
| - lll | ||
| path: scion-pki/certs/(certinfo|certformat).go | ||
| - linters: | ||
| - goheader | ||
| path: pkg/scrypto/cms | ||
| paths: | ||
| - third_party$ | ||
| - builtin$ | ||
| - examples$ | ||
| formatters: | ||
| enable: | ||
| - gofmt | ||
| - goimports | ||
| settings: | ||
| goimports: | ||
| local-prefixes: | ||
| - github.com/scionproto/scion | ||
| exclusions: | ||
| generated: lax | ||
| paths: | ||
| - third_party$ | ||
| - builtin$ | ||
| - examples$ | ||
This file was deleted.
Oops, something went wrong.
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
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be QF1001 can be disabled from staticcheck. so we do not have to always bend to a machine's opinion regarding the legibility of boolean expressions?
Viewed in some else's config file:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll keep the changes to the existing expressions since some of them are both IMHO and in @katyatitkova opinion more readable now (less unnecessary negation) but I'll disable QF1001