can flake8 *fix* my python whitespace problems?
Asked Answered
C

1

18

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?

Cohbert answered 21/6, 2020 at 18:15 Comment(2)
no, flake8 is a linter only -- you'll want a code formatter to do code formatting (such as autopep8 / add-trailing-comma / yapf / black / etc.)Leelah
@AnthonySottile, thanks. If you can make that an answer, I can accept it. I'm unclear why this question was downvoted.Cohbert
L
26

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

Leelah answered 23/6, 2020 at 19:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.