-
Notifications
You must be signed in to change notification settings - Fork 24
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
A003 should be disabled by default #75
Comments
Thanks for using flake8-builtins and even spending the time to report the problems you have with it! (and sorry that you have problems with it 😓 ) I see the point, on data models indeed it makes more sense, in general classes though I still think that it should try to avoid using builtins... maybe #74 would be a better middle ground? 🤔 Would you agree on that direction? Would you have the extra time to actually do PR with the changes? |
I don't think this issue has anything to do with #74. The easiest way to deal with this issue now is just to ignore A003 in class C:
id = 1
print(id(C())) The middle ground is to disable this rule by default, so if the one in a million person who needs it, he can turn it on. |
Looking at the changelog seems that from version 1.3.0 we have this I'm sorry if it's not your intention, but your way to tell what needs to be done rather than asking is a bit annoying to be honest. You have multiple options:
The idea of |
A001 already takes care of this use case, either because of the assignment or the function name. You don't need A003. Perhaps you need an A004 to cover the case where you shadow a builtin on a function, but not methods of class variables, both of which places you can't access directly except in extraordinarily rare circumstances.
I don't have a question. I have a request, and I said please. Stating a position is common way to start a discussion, and I expect and will respect different but reasonable positions, I just fail to think of any. Would you like me to sandwich both of my messages with irrelevant greetings, appreciations and provide a list of rationales in multiple paragraphs? If that's the case perhaps you should state that clearly with a Github template, otherwise I'll act like how people have acted since the beginning of the internet on public forums and mailing lists.
I take this as an agreement that A003 should be disabled by default. |
Hi ! In my project we had our own
which raises an So my suggestion is that this becomes a Regardless, thank you so much for your work. |
Hi, I'd also like to +1 this suggestion. This warning is a false positive because a class attribute can never conflict with the builtin. For example, my custom LinkedList class is unable to use
|
Hi, I think a better approach would be to refine the rule rather than disabling it. Class attributes are only accessed by name during class definition (e.g. specifying argument defaults), which is a unique use-case. Perhaps this rule can be split in two? One for general variables and one for variables inside classes? |
@Rizhiy there already exists A001 and A004 |
@wyuenho Thanks, I guess then I agree that A003 is better disabled by default |
I'm going to close this issue as the PR has been hanging around for over a year and the maintainer just chose to ignore it. I've switched over to ruff and I no longer use this package. Please open a new issue and discuss among yourselves. Hopefully the 11th person who is bothered by this problem is going to change his mind. Good luck. |
Consider the following example:
Class attributes are almost never accessed by themselves without going through an object or a class, so what's the point of this rule? If you must preserve this rule, please disable it by default.
The text was updated successfully, but these errors were encountered: