Reputation: 29655
I just learned about flake8, which calls itself "Flake8: Your Tool For Style Guide Enforcement." While flake8 will find many Python whitespace errors and enforce PEP8, it does not appear to have an option to automatically fix problematic python code.
autopep8 does appear to have this option (called --in-place
), but flake8 seems to have much wider support.
Is there a way to make flake8 fix my code?
Upvotes: 21
Views: 23182
Reputation: 69934
no, flake8 is a linter only -- that is, it only checks your code. (technically, flake8 doesn't even check your code -- it is just a framework for other linters to plug into and provides inclusion / exclusion / etc. on top of other tools)
if you want something which fixes your code, you'll want a code formatter to do code formatting (such as autopep8 / add-trailing-comma / yapf / black / etc.)
Upvotes: 29