我正在flake8
为 Python使用linter,我有许多代码格式问题,例如blank line contains whitespace flake8(W293)
我正在尝试自动修复这些 linting 问题。我有这些设置:
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.linting.lintOnSave": true,
"python.linting.flake8Args": [
"--ignore=E501",
],
"editor.formatOnSave": true
但是当我保存文件或运行命令时没有任何反应Format Document
。
有没有办法自动修复这些 linting 错误?
例如,我建议使用formatter
, black来修复linter
.
如果是这样,“pip install”它并将其添加到您的settings.json:
"python.formatting.provider": "black"
然后,按Alt+ShifT+F
或Ctrl+S
应触发脚本的格式设置。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句