-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
chore: enable var-naming from revive #1817
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
Conversation
c32cfea
to
e4e5f38
Compare
Signed-off-by: Matthieu MOREL <[email protected]>
e4e5f38
to
9925fd4
Compare
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.
Pull Request Overview
This PR enables the var-naming rule from revive by activating the linter for variable naming and adding "//nolint:revive //FIXME" comments on code that does not comply with the new lint rule. The changes include updating the .golangci.yml file to configure var-naming, refactoring private variable and function names in various files, and adding nolint comments to preserve existing naming where a fix isn’t applied.
Reviewed Changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
.golangci.yml | Enables var-naming with specific allowed and denied list arguments |
host/*.go | Adds nolint:revive comments for var naming corrections |
cpu/.go, net/.go, load/*.go | Applies naming fixes and nolint:revive comments across multiple platforms |
process/*.go | Refactors variable names for consistency and clarity |
disk/.go, internal/common/ | Updates naming to meet var naming conventions |
Comments suppressed due to low confidence (2)
net/net_linux.go:36
- The constant name 'CT_EXPEctNEW' appears to contain a typo. Consider renaming it to 'CT_EXPECT_NEW' for clarity.
CT_EXPEctNEW //nolint:revive //FIXME
net/net_linux.go:38
- The constant name 'CT_EXPEctDELETE' appears to contain a typo. Consider renaming it to 'CT_EXPECT_DELETE' for clarity.
CT_EXPEctDELETE //nolint:revive //FIXME
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.
Sorry for the long delay, but I have reviewed all of this PR and think it LGTM. However, I would like to exclude these lint rules for auto-generated files.
That said, at the moment, we are making manual changes after generating the files, as seen here:
https://github.com/shirou/gopsutil/pull/1817/files#diff-faf6b4886c9d98b986c892b2e29cda6c98bde8752b2df7552af7079436d08ecbR19-R22,
so for now, I don't think it's an issue, because it's not fully auto-generated. Then I will merge your great PR.
However, in the future, if I decide to disable this linting for certain files, I hope you’ll understand.
By design and by default golangci lint is ignoring generated files . They are usually identified with a comment header like this one: I just provide my knowledge and what I believe could help the project so you as maintainer can decide what you want to do with it 😉. |
Description
Enable var-naming from revive
Only fixes private variable or functions naming and add
nolint:revive //FIXME
to the rest of cases.