-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat: syntax to not override severity from linters #4472
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Merged
Merged
Conversation
This file contains 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
22c8c3d
to
7a27d49
Compare
Maybe |
alexandear
approved these changes
Mar 9, 2024
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 propose @inherit
instead of @
. Or we can use @linter
.
|
Inspire by DNS notation
c1582ec
to
6c033fa
Compare
Antonboom
reviewed
Mar 12, 2024
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.
👍
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Labels
area: config
Related to .golangci.yml and/or cli options
area: severity
enhancement
New feature or improvement
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.
When I created #4452, I thought that only one linter produced issues with severities.
But it's not true as you can see here #4470
The previous option was global: affects all the linters.
The first problem is that
revive
useswarning
anderror
as severity, butgosec
useslow
,medium
, andhigh
.I don't want to convert one to another because:
The second problem is related to the fact that some tools allow only the usage of specific severity.
The current option will keep the severity value from all linters, then the values will be a mix of the different sets.
If you need to use only one set of severities, you need to override/replace the severities from the unsupported set of values.
Then, I reverted the previous PR #4452 (first commit) and replaced it with the usage of a specific wildcard value (
@linter
) as severity.The value@
is inspired by some DNS convention, but we can use another character (*
is ambiguous).This value can be used as a default severity or as a rule severity.
One commit, one change.
The following examples illustrate the behavior.
the code sample
no custom severities
`@linter` as rule severity
`@linter` as default value
Fixes #3111