-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
C0103/invalid-name
/N815/N806: Allow specifying valid identifier patterns (e.g. as regular expressions)
#7660
Comments
Hey, the option |
## Summary Improves the documentation on the setting itself, along with that on the relevant rules. Closes #7660.
Hey, thanks for your work on ruff! (Disclaimer, @richardebeling and I both work on the project mentioned in the initial comment) I feel that globs are not really a satisfying solution in this case. Although #2787 initially asked for glob support, the arguments for it were "only fixed strings currently supported" and "want to allow In general, globs are really meant for matching file paths and their only advantage over regex is the We thought about this for some time and also wanted to bring another point up: Maybe the current architecture of the A symptom of this "problem" is that the current file structure,
already encodes too specialized knowledge of pep8 standards and makes it difficult to introduce features like "check that it matches a regex" (Currently, I think there isn't really a way to enforce that, for example, no snake case I would really like to hear your thoughts on this :) |
For it's
invalid-name
/C0103 rule, pylint allows freely configuring what a legal name for an identifier is using regular expressions.In particular, for a project, I'd like certain identifiers to use CapWords/PascalCase. (In case the actual use case is relevant: In django, sometimes "Formset" classes are created by factory-methods, and we want to use CapWords naming for them to match the official documentation)
In #970, pylint's
invalid-name
is checked as "done" and references N815. For me, the following code triggers N806 and I do not find any configuration option that would allow the CamelCase variable. The docs on N806 only list apep8-naming.ignore-names
option, which in turn doesn't seem to support regular expressions.where I can do this with pylint:
The text was updated successfully, but these errors were encountered: