1

Syntastic并且不忽略配置文件flake8中提供的错误。vimflake8

我正在使用inflake8进行 python 代码检查。我每个文档都有一个忽略错误的配置文件。现在,当我通过键入从命令行运行时Syntasticvimflake8flake8absolute_path_to_home/.config/flake8E251flake8

flake8 --config=absolute_path_to_home/.config/flake8 my_python_code_that_is_being_checked.py

然后flake8忽略错误E251。但是,当我flake8使用 vim 中<F7>的错误窗口在 vim 中运行时,E251尽管它在flake8配置文件中被忽略了。

为了确保Syntastic调用flake8正确的参数,我将以下内容添加到我的.vimrc

let g:syntastic_python_checkers = ['flake8']
let g:syntastic_python_flake8_args='--config=absolute_path_to_home/.config/flake8'
let g:syntastic_debug = 1

我检查了Syntastic内部vim使用:messages并获得以下信息

syntastic: 4.483755: CacheErrors: Invoking checker: python/flake8
syntastic: 4.484046: SyntasticMake: called with options: {'errorformat': '%E%f:%l: could not compile,%-Z%p^,%A%f:%l:%c: %m,%A%f:%l: %m,%-G%.%#', 
'makeprg':'flake8 --config=absolute_path_to_home/.config/flake8 my_python_code_that_is_being_checked.py', 'env': {'TERM': 'dumb'}}
syntastic: 4.615727: system: command run in 0.131497s
syntastic: 4.617432: getLocList: checker python/flake8 returned 1
syntastic: 4.618452: getLocList: checker python/flake8 run in 0.134634s

因此,如果可以相信上面的消息,那么Syntastic确实是flake8使用正确的配置文件进行调用,所以我不确定为什么E251仍然显示。下面的好措施是我的absolute_path_to_home/.config/flake8文件

[flake8]
ignore = E251

这是一个已知的错误?我究竟做错了什么?将不胜感激任何帮助。谢谢你。

4

0 回答 0