flake8 可以 *修复* 我的 python 空格问题吗?

can flake8 *fix* my python whitespace problems?

我刚了解到 flake8, which calls itself "Flake8: Your Tool For Style Guide Enforcement." While flake8 will find many Python whitespace errors and enforce PEP8,它似乎没有自动修复有问题的 python 代码的选项。

autopep8 似乎有这个选项(称为 --in-place),但 flake8 似乎有更广泛的支持。

有没有办法让 flake8 修复我的代码?

不,flake8 只是一个 linter——也就是说,它只检查你的代码。 (从技术上讲,flake8 甚至不会检查您的代码——它只是一个供其他 linter 插入的框架,并在其他工具之上提供包含/排除等)

如果你想要修复代码的东西,你需要一个代码格式化程序来进行代码格式化(例如 autopep8 / add-trailing-comma / yapf / black / 等)