-
Notifications
You must be signed in to change notification settings - Fork 1.7k
The non_constant_identifier_names lint should ignore a leading underscore #58288
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
Comments
I agree that a leading underscore should be ignored. Side note on naming: Yes, it's unfortunate that the lint names don't all conform to a standard naming scheme. If it weren't for the pain it would cause users I'd suggest renaming them all more consistently, but I can't convince myself that it would be a net positive from a user perspective. But we realized awhile back that we'd made a mistake by using "prefer", "avoid" and other terms from the style guide because the style guide has, in a few cases, changed since the lints were originally named and now the names are inconsistent. |
The issue w/ lint naming inconsistency bothers me daily. I really wish we'd been more principled and consistent but as Brian points out, our ideas have evolved. Thinking ahead, it'd be cool to do a renaming at some point but so far the pain hasn't seemed worth it. (Maybe we can revisit if bulk fixing takes off?) (FWIW there's some related discussion in #57794.) As for this lint misfiring, my sense is that it should be further expanded to allow for underscores in function declarations too (and am somewhat baffled that it hasn't already...) Thoughts? |
If there are a few lint names that really stand out, we could rename them to get a better sense for the cost to the ecosystem. We'd likely want to do something like have two names for the lint - the new and the deprecated old - show a deprecation messages, and possibly, have a quick fix to convert from the old to the new. |
That sounds like a reasonable path forward. Perhaps Phil and I can carve out a few hours to review the lint names at some point to see what the magnitude of the changes might be. |
SGTM! |
Taking a closer look, the issue here is not the leading underscores, it's what follows. Specifically _recursion(). To fix it, consider renaming to: |
Closing as working as intended. |
The non_constant_identifier_names should likely ignore a leading underscore. For methods names like
void _checkAssignment_recursion()
, I see:Also, the code for the lint is non_constant_identifier_names, which seems like it describes the items it applies to, instead of what it does (like 'prefer_lower_camel_case').
The text was updated successfully, but these errors were encountered: