Skip to content

Add lint long_variable_names #14818

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JurrianFahner
Copy link

@JurrianFahner JurrianFahner commented May 15, 2025

The lint is configurable by using max-variable-name-length.

Partly fixes #644 this PR only concerns the variable length

changelog: [long_variable_names]: enable variable length check in clippy

The lint is configurable by using `max-variable-name-length`.
@rustbot
Copy link
Collaborator

rustbot commented May 15, 2025

r? @Jarcho

rustbot has assigned @Jarcho.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label May 15, 2025
@JurrianFahner
Copy link
Author

JurrianFahner commented May 15, 2025

r? @llogiq thanks for your clippy workshop today! Looking forward for your feedback.

@JurrianFahner
Copy link
Author

JurrianFahner commented May 15, 2025

I doubt whether the default value is well chosen. 30 seems ok for most of the use cases. But for the clippy source it was needed to create some different configurations too.

@rustbot rustbot assigned llogiq and unassigned Jarcho May 15, 2025
Copy link
Contributor

@llogiq llogiq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, so I'd like to make sure that we have some benefit if we actually have that lint warn. I figure we either make it a pedantic lint or we set a far higher default threshold. When in doubt, you can run lintcheck.

Otherwise this looks good to merge.

/// ```
#[clippy::version = "1.88.0"]
pub LONG_VARIABLE_NAMES,
style,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if we make it warn by default, we better pick a really large threshold. Adding warnings to many folks' CI jobs should have some serious benefit to make up for the hassle. So I'd either make it pedantic (which is allow by default) or set the default absurdly high, e.g. 100, so people who think this is a good idea can introduce tighter bounds to their projects.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels May 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lint non-expressive variable names
4 participants