我正在使用Python的flake8
linter,我有许多代码格式问题,比如blank line contains whitespace flake8(W293)
我正在尝试自动修复这些起毛问题。我有以下设置:
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.linting.lintOnSave": true,
"python.linting.flake8Args": [
"--ignore=E501",
],
"editor.formatOnSave": true
我正在使用默认的autopep8
格式化程序,但它似乎什么也不做。
保存文件或运行命令Format Document
时不会发生任何事情
有没有办法自动修复这些起毛错误
应该是:
您可以将格式转换为
yapf
或black
如果坚持
autopep8
,可以在settings.json中添加:我建议使用
formatter
,black来修复linter
检测到的问题如果是这样,“pip安装”它并将其添加到您的设置中。json:
然后,按
Alt+ShifT+F
或Ctrl+S
将触发脚本的格式设置相关问题 更多 >
编程相关推荐