Skip to content

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

Merged
merged 1 commit into from
Mar 21, 2025

Conversation

mmorel-35
Copy link
Contributor

Description

Enable var-naming from revive

Only fixes private variable or functions naming and add nolint:revive //FIXME to the rest of cases.

@shirou shirou requested a review from Copilot March 16, 2025 12:32
Copy link

@Copilot Copilot AI left a 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

Copy link
Owner

@shirou shirou left a 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.

@shirou shirou merged commit 2ab27a0 into shirou:master Mar 21, 2025
51 checks passed
@mmorel-35
Copy link
Contributor Author

mmorel-35 commented Mar 21, 2025

By design and by default golangci lint is ignoring generated files . They are usually identified with a comment header like this one:
// Code generated … DO NOT EDIT.

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 😉.

@mmorel-35 mmorel-35 deleted the revive/var-naming branch March 21, 2025 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants