-
Notifications
You must be signed in to change notification settings - Fork 64
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
Find better linting tool #409
Comments
@icemac do you know about an alternative? |
@malthe Have you had a look at I found that pylint usually goes too much in the other direction. But you could also check out ruff, which re-implements most of the rules from a variety of popular linters in Rust (as well as with the extended ability to auto-fix some of them), which would let you hand pick from a greater variety of rules without having to install dozens of different tools/plugins. Can you give some examples of rules you're missing or where the rate of false positive/negatives is too high, besides the bare except case? |
On the note of tooling, have you considered adding pre-commit? I use it pretty much in all my projects now and it's saved me a lot of headaches. It's really easy to forget to run one of the tox environments, such as type checking or linting, because you were focused on fixing a test or vice versa, so pre-commit helps to save you from yourself. |
A rule that I'm missing is that bare except is okay on re-raise. Flake8 can't do that because it can't look ahead! |
@malthe flake8-bugbear is an AST plugin, so you probably could implement that exception to the rule fairly easily and contribute it. Generally you can achieve a lot with plugins, the reason why pycodestyle isn't as powerful is because it just looks at the source code directly, rather than the AST, but flake8 plugins are free to either use AST or source code lines, so it's not a limitation with flake8 in general. |
I'd also suggest ruff, even though I've only used it once. I did: try:
1/0
except:
print('error')
raise
|
I would also suggest ruff. I use |
We should move away from pycodestyle (used by Flake8) which has some inherent design limitations such as not being able to qualify an analysis outside of the current syntax unit, see for example PyCQA/pycodestyle#703.
The text was updated successfully, but these errors were encountered: