-
Notifications
You must be signed in to change notification settings - Fork 93
linter: migrate linter config, upgrade linter, enable gomod linter #1722
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
11 commits
Select commit
Hold shift + click to select a range
2385383
linter: upgrade to v2 configuration
lzap 3d90003
linter: enable gomoddirectives linter
lzap 66bf61d
linter: upgrade linter GHA to v2.3
lzap fa82f73
linter: disable unnecessary field selector
lzap 037f93b
linter: disable error strings
lzap c5823f2
many: simplify vars via type inference
lzap 137ba14
many: use ReplaceAll instead of Replace
lzap aa2f16c
many: use switch statements for better readability
lzap ebfc25d
dnfjson: use Fprintf instead of write
lzap 9f6fb6f
many: simplify if statements
lzap 9726023
linter: skip possible nil pointer dereference
lzap 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
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,29 +1,68 @@ | ||
| --- | ||
| linters-settings: | ||
| govet: | ||
| disable: | ||
| - shadow # default value recommended by golangci | ||
| - composites | ||
| gosec: | ||
| excludes: | ||
| - G101 | ||
| version: "2" | ||
| run: | ||
| build-tags: | ||
| - integration | ||
|
|
||
| linters: | ||
| enable: | ||
| - gosec | ||
|
|
||
| run: | ||
| build-tags: | ||
| - integration | ||
| timeout: 5m | ||
| - gomoddirectives | ||
| - staticcheck | ||
| settings: | ||
| gosec: | ||
| excludes: | ||
| - G101 | ||
| govet: | ||
| disable: | ||
| # default value recommended by golangci | ||
| - shadow | ||
| - composites | ||
| exclusions: | ||
| generated: lax | ||
| presets: | ||
| - comments | ||
| - common-false-positives | ||
| - legacy | ||
| - std-error-handling | ||
| rules: | ||
| - linters: | ||
| - gosec | ||
| path: ^(images/)?(pkg|internal)/.*_test\.go$ | ||
| # unnecessary field selector | ||
| - linters: | ||
| - staticcheck | ||
| text: "QF1008" | ||
| # error strings should not be capitalized | ||
|
lzap marked this conversation as resolved.
|
||
| - linters: | ||
| - staticcheck | ||
| text: "ST1005" | ||
| # unicode control character | ||
| - linters: | ||
| - staticcheck | ||
| path: ^(images/)?(pkg|internal)/.*_test\.go$ | ||
| text: "ST1018" | ||
| # possible nil pointer dereference (many false alerts when t.Skip is used) | ||
| - linters: | ||
| - staticcheck | ||
| path: ^(images/)?(pkg|internal|internal/test)/(.*_test|helpers)\.go$ | ||
| text: "SA5011" | ||
| paths: | ||
| - third_party$ | ||
| - builtin$ | ||
| - examples$ | ||
|
|
||
| issues: | ||
| # 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-rules: | ||
| - path: ^(images/)?(pkg|internal)/.*_test\.go$ | ||
| linters: ["gosec"] | ||
|
|
||
| formatters: | ||
| exclusions: | ||
| generated: lax | ||
| paths: | ||
| - third_party$ | ||
| - builtin$ | ||
| - examples$ | ||
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
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 |
|---|---|---|
|
|
@@ -693,7 +693,7 @@ func (r *Request) Hash() string { | |
| for _, repo := range r.Arguments.Repos { | ||
| h.Write([]byte(repo.Hash())) | ||
| } | ||
| h.Write([]byte(fmt.Sprintf("%T", r.Arguments.Search.Latest))) | ||
| fmt.Fprintf(h, "%T", r.Arguments.Search.Latest) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nitpick: Commit message says "use sprintf" instead of "use fprintf". |
||
| h.Write([]byte(strings.Join(r.Arguments.Search.Packages, ""))) | ||
|
|
||
| return fmt.Sprintf("%x", h.Sum(nil)) | ||
|
|
@@ -849,7 +849,7 @@ func parseError(data []byte, repos []repoConfig) Error { | |
| if len(repo.Name) > 0 { | ||
| nameURL = fmt.Sprintf("%s: %s", repo.Name, nameURL) | ||
| } | ||
| e.Reason = strings.Replace(e.Reason, idstr, fmt.Sprintf("%s [%s]", idstr, nameURL), -1) | ||
| e.Reason = strings.ReplaceAll(e.Reason, idstr, fmt.Sprintf("%s [%s]", idstr, nameURL)) | ||
| } | ||
|
|
||
| return e | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.