flake8-builtins
flake8-builtins copied to clipboard
Add option to ignore certain builtins
flake8-builtins complains about variables named license
, which honestly I don't understand why it even exists outside of the REPL. I don't want to rename them to lic
, licence
, licence_
or similar, so it would be nice to not have to sprinkle my code with # noqa
everywhere.
Hi @nyuszika7h thanks for using flake8-builtins
and taking the time to report about it! ✨
Might it be fixed if eventually #73 is implemented? 🤔 reopen if you think otherwise.
No, that's the opposite of what I want. That issue suggests adding an option to recognize more identifiers as builtins, but I want it to ignore one that's technically a builtin but basically never used.
(Yes, I could see how it could lead to issues if I forget to define the variable and accidentally use the builtin instead and flake8 doesn't yell at me that it's undefined, but mypy should take care of that.)
Oh right, sorry, I probably did not read your message properly 🙋🏾 sorry! 🙇🏾
I noticed credits
is already ignored, so maybe license
could be just added similarly. But I wouldn't mind it being an option either.
Upon further investigation, I realized that credits
and license
are both part of the site
module, and are not defined when using python -S
. So this reinforces that it might be reasonable to add it to the default ignore list, or at least add an ignore_site
option.
Nobody should be using those in scripts anyway (though some people may misuse exit()
instead of sys.exit()
), so the only potential concern is not being warned about accidentally using the site definition instead of your own if you made a typo, though that can probably be handled by another plugin.
Yes, that's what I really wanted to do at some point, fortunately @gsingh93 did the heavy work on #80 and I did the extra work on #86 to get it merged 😄
@nyuszika7h sorry to bother again, I see that what you were asking is to have license
and credits
ignored by default, with the changes on #85 and #86 you would be able to at least ignore them on the command line when calling flake8, would that be at least a mid term solution?
I'm afraid that saying yes to ignore credits
and license
will open the can of worms to others saying, that if it was done once, it could also be done also for X
and Y
😓
Having it be configurable is enough for me, I was only suggesting a potential default ignore for all site modules because credits
was already on the default ignore list.