Using pylint to find a lot of problems. #900
LunaCodeDemon
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I understand that you don't want any changes that you might not understand or aren't big changes in itself.
Therefore I will suggest you use a linting tool to detect those yourself, giving you control on how you handle those flaws.
I know that you recently used a formatting tool, which usually can only correct spacing.
Good use of a linting tool can make a formatting tool more or less obsolete.
Their usage is entirely different.
While a formatting tool changes how code appears, a linting tool just has the task to tell you where the code can be improved.
For example a linting tool would tell you that you could change this
to a slightly faster and maybe more readable.
Additionally it would tell you something like
Redefining name 'x' from outer scope
because in line 1735 the x is in outer scope, which could lead to unexpected behavior on exception handling.Of course it's not a magic tool that will fix all your problems, but it can detect a huge amount of common mistakes.
You can disable warnings, which is useful for things like trailing whitespaces.
Linting tools that the most people use are either pylint or flake8.
I would recommend pylint, but that is your choice.
A linting tool can be added to an editor over a plugin and some already have functionality for such tools included.
Here a link to the Visual Code documentation page about linting: https://code.visualstudio.com/docs/python/linting
Bonus: Once everything is fixed you can even use the linting tool to check pull requests for mistakes.
TLDR: Install linting tool into your editor, slowly optimize your code and no one will make pull requests just for changing a
==
tois
Beta Was this translation helpful? Give feedback.
All reactions