Skip to content
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

Add option to ignore certain builtins #74

Closed
ghost opened this issue Feb 20, 2022 · 8 comments
Closed

Add option to ignore certain builtins #74

ghost opened this issue Feb 20, 2022 · 8 comments

Comments

@ghost
Copy link

ghost commented Feb 20, 2022

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.

@gforcada
Copy link
Owner

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.

@ghost
Copy link
Author

ghost commented Feb 25, 2022

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.)

@gforcada
Copy link
Owner

gforcada commented Mar 1, 2022

Oh right, sorry, I probably did not read your message properly 🙋🏾 sorry! 🙇🏾

@ghost
Copy link
Author

ghost commented Aug 28, 2022

I noticed credits is already ignored, so maybe license could be just added similarly. But I wouldn't mind it being an option either.

@ghost
Copy link
Author

ghost commented Oct 1, 2022

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.

@gforcada
Copy link
Owner

gforcada commented Oct 8, 2022

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 😄

@gforcada gforcada closed this as completed Oct 8, 2022
@gforcada
Copy link
Owner

gforcada commented Oct 8, 2022

@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 😓

@ghost
Copy link
Author

ghost commented Oct 8, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant