我正在尝试flake8用作在 neovim v0.5 上使用的默认 python python-language-serverlinter。
python-lsp 文档说设置pylsp.configurationSources为['flake8'],但没有指定要编辑的文件。
这个配置文件在哪里?
我正在尝试flake8用作在 neovim v0.5 上使用的默认 python python-language-serverlinter。
python-lsp 文档说设置pylsp.configurationSources为['flake8'],但没有指定要编辑的文件。
这个配置文件在哪里?
根据flake8 文档,flake8 配置的位置因系统而异,在 Linux 和 Mac 上是~/.config/flake8,对于 Windows,它是$HOME\.flake8($HOME就像C:\\Users\sigmavirus24)。内容应为 INI 格式:
[flake8]
max-line-length = 100
max-complexity = 30
ignore =
# missing whitespace around arithmetic operator
E226,
# line break before/after binary operator
W503,
W504,
# expected 1 blank line, found 0
E301,E302,
要抑制单个警告,添加# noqa: F841类似(将代码更改为您要使用的实际代码)注释字符串来抑制它也很方便。
参考:https ://jdhao.github.io/2020/11/05/pyls_flake8_setup/#config-location