golangci-lint
golangci-lint copied to clipboard
feat: Add logrlint
https://github.com/timonwong/logrlint
logrlint is a linter for go-logr/logr, which lint the number of key value pairs (should be even).
Though I'm not sure whether it's good to add a very specific linter here :(
Hey, thank you for opening your first Pull Request !
In order for a pull request adding a linter to be reviewed, the linter and the PR must follow some requirements.
Pull Request Description
- [x] It must have a link to the linter repository.
- [x] It must provide a short description about the linter.
Linter
- [x] It must not be a duplicate of another linter or a rule of a linter. (the team will help to verify that)
- [x] It must have a valid license and the file must contain the required information by the license, ex: author, year, etc.
- [x] The linter repository must have a CI and tests.
- [x] It must use
go/analysis
. - [x] It must have a valid tag, ex:
v1.0.0
,v0.1.0
. - [x] It must not contain
init()
. - [x] It must not contain
panic()
,log.fatal()
,os.exit()
, or similar. - [x] It must not have false positives/negatives. (the team will help to verify that)
- [x] It must have tests inside golangci-lint.
The Linter Tests Inside Golangci-lint
- [x] They must have at least one std lib import.
- [x] They must work with
T=<name of the linter test file>.go make test_linters
. (the team will help to verify that)
.golangci.reference.yml
- [x] The linter must be added to the list of available linters (alphabetical case-insensitive order).
-
enable
anddisable
options
-
- [x] If the linter has a configuration, the exhaustive configuration of the linter must be added (alphabetical case-insensitive order)
- The values must be different from the default ones.
- The default values must be defined in a comment.
- The option must have a short description.
Others Requirements
- [x] The files (tests and linter) inside golangci-lint must have the same name as the linter.
- [x] The
.golangci.yml
of golangci-lint itself must not be edited and the linter must not be added to this file. - [x] The linters must be sorted in the alphabetical order (case-insensitive) in the
Manager.GetAllSupportedLinterConfigs(...)
and.golangci.reference.yml
. - [x] The load mode (
WithLoadMode(...)
):- if the linter doesn't use types:
goanalysis.LoadModeSyntax
-
goanalysis.LoadModeTypesInfo
requiredWithLoadForGoAnalysis()
in theManager.GetAllSupportedLinterConfigs(...)
- if the linter doesn't use types:
- [x] The version in
WithSince(...)
must be the next minor version (v1.X.0
) of golangci-lint.
Recommendations
- [x] The linter should not use SSA. (currently, SSA does not support generics)
- [x] The linter repository should have a readme and linting.
- [ ] The linter should be published as a binary. (useful to diagnose bug origins)
The golangci-lint team will edit this comment to check the boxes before and during the review.
This checklist does not imply that we will accept the linter.
@timonwong What made you decide to archive the repository? I see it's been moved to a new one, but it makes for an annoying set of changes to golangci-lint to get a dependency update now...
@gabizou https://github.com/golangci/golangci-lint/pull/3144
Hi, sorry for the late comment.
It appears https://github.com/timonwong/logrlint is "archived." I learned about this via trying to report an issue with logrlint
not supporting (or not working corectly) with variadic functions:
logger/logger.go:54:28: odd number of arguments passed as key-value pairs for logging (logrlint)
l.V(DebugLevel).Info(msg, keysAndValues...)
^
What's the proper course to address this issue?
A follow-up (related) question - should golangci-lint
use (support) linters from the "archived" GitHub repos?
https://github.com/golangci/golangci-lint/pull/3144