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?
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.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With