flake8 忽略配置文件和 vimrc

flake8 ignores config file and vimrc

我想在我的 python 文件中将一行中允许的最大字符数从 80 扩展到 120(或者完全忽略 flake8 中的 E501)。我有一个 flake8 配置文件 ~/.config8/flake8,其中包含

[flake8]
ignore = E501
max-line-length = 120

但是,在 vim 内部和终端中,这些行似乎都没有被拾取。在 this advice 之后,我还在我的 ~/.vimrc 中添加了以下行:

let g:syntastic_python_flake8_args='--ignore=E501'

但 E501 仍然像以前一样显示(我的 ~/.vimrc 中的所有其他命令都被 vim 正确读取)。

我的flake8 --versionreturns4.0.1 (mccabe: 0.6.1, pycodestyle: 2.8.0, pyflakes: 2.4.0) CPython 3.7.10 on Linuxflake8 --version在终端returns下面几行:

flake8.plugins.manager    MainProcess     61 INFO     Loading entry-points for "flake8.extension".
flake8.plugins.manager    MainProcess    109 INFO     Loading entry-points for "flake8.report".
flake8.plugins.manager    MainProcess    140 INFO     Loading plugin "C90" from entry-point.
flake8.plugins.manager    MainProcess    141 INFO     Loading plugin "F" from entry-point.
flake8.plugins.manager    MainProcess    153 INFO     Loading plugin "pycodestyle.ambiguous_identifier" from entry-point.
flake8.plugins.manager    MainProcess    157 INFO     Loading plugin "pycodestyle.bare_except" from entry-point.
flake8.plugins.manager    MainProcess    157 INFO     Loading plugin "pycodestyle.blank_lines" from entry-point.
flake8.plugins.manager    MainProcess    157 INFO     Loading plugin "pycodestyle.break_after_binary_operator" from entry-point.
flake8.plugins.manager    MainProcess    157 INFO     Loading plugin "pycodestyle.break_before_binary_operator" from entry-point.
flake8.plugins.manager    MainProcess    157 INFO     Loading plugin "pycodestyle.comparison_negative" from entry-point.
flake8.plugins.manager    MainProcess    157 INFO     Loading plugin "pycodestyle.comparison_to_singleton" from entry-point.
flake8.plugins.manager    MainProcess    157 INFO     Loading plugin "pycodestyle.comparison_type" from entry-point.
flake8.plugins.manager    MainProcess    157 INFO     Loading plugin "pycodestyle.compound_statements" from entry-point.
flake8.plugins.manager    MainProcess    157 INFO     Loading plugin "pycodestyle.continued_indentation" from entry-point.
flake8.plugins.manager    MainProcess    157 INFO     Loading plugin "pycodestyle.explicit_line_join" from entry-point.
flake8.plugins.manager    MainProcess    157 INFO     Loading plugin "pycodestyle.extraneous_whitespace" from entry-point.
flake8.plugins.manager    MainProcess    157 INFO     Loading plugin "pycodestyle.imports_on_separate_lines" from entry-point.
flake8.plugins.manager    MainProcess    157 INFO     Loading plugin "pycodestyle.indentation" from entry-point.
flake8.plugins.manager    MainProcess    157 INFO     Loading plugin "pycodestyle.maximum_doc_length" from entry-point.
flake8.plugins.manager    MainProcess    157 INFO     Loading plugin "pycodestyle.maximum_line_length" from entry-point.
flake8.plugins.manager    MainProcess    157 INFO     Loading plugin "pycodestyle.missing_whitespace" from entry-point.
flake8.plugins.manager    MainProcess    157 INFO     Loading plugin "pycodestyle.missing_whitespace_after_import_keyword" from entry-point.
flake8.plugins.manager    MainProcess    157 INFO     Loading plugin "pycodestyle.missing_whitespace_around_operator" from entry-point.
flake8.plugins.manager    MainProcess    157 INFO     Loading plugin "pycodestyle.module_imports_on_top_of_file" from entry-point.
flake8.plugins.manager    MainProcess    157 INFO     Loading plugin "pycodestyle.python_3000_async_await_keywords" from entry-point.
flake8.plugins.manager    MainProcess    157 INFO     Loading plugin "pycodestyle.python_3000_backticks" from entry-point.
flake8.plugins.manager    MainProcess    157 INFO     Loading plugin "pycodestyle.python_3000_has_key" from entry-point.
flake8.plugins.manager    MainProcess    157 INFO     Loading plugin "pycodestyle.python_3000_invalid_escape_sequence" from entry-point.
flake8.plugins.manager    MainProcess    157 INFO     Loading plugin "pycodestyle.python_3000_not_equal" from entry-point.
flake8.plugins.manager    MainProcess    157 INFO     Loading plugin "pycodestyle.python_3000_raise_comma" from entry-point.
flake8.plugins.manager    MainProcess    157 INFO     Loading plugin "pycodestyle.tabs_obsolete" from entry-point.
flake8.plugins.manager    MainProcess    157 INFO     Loading plugin "pycodestyle.tabs_or_spaces" from entry-point.
flake8.plugins.manager    MainProcess    158 INFO     Loading plugin "pycodestyle.trailing_blank_lines" from entry-point.
flake8.plugins.manager    MainProcess    158 INFO     Loading plugin "pycodestyle.trailing_whitespace" from entry-point.
flake8.plugins.manager    MainProcess    158 INFO     Loading plugin "pycodestyle.whitespace_around_comma" from entry-point.
flake8.plugins.manager    MainProcess    158 INFO     Loading plugin "pycodestyle.whitespace_around_keywords" from entry-point.
flake8.plugins.manager    MainProcess    158 INFO     Loading plugin "pycodestyle.whitespace_around_named_parameter_equals" from entry-point.
flake8.plugins.manager    MainProcess    158 INFO     Loading plugin "pycodestyle.whitespace_around_operator" from entry-point.
flake8.plugins.manager    MainProcess    158 INFO     Loading plugin "pycodestyle.whitespace_before_comment" from entry-point.
flake8.plugins.manager    MainProcess    158 INFO     Loading plugin "pycodestyle.whitespace_before_parameters" from entry-point.
flake8.plugins.manager    MainProcess    158 INFO     Loading plugin "default" from entry-point.
flake8.plugins.manager    MainProcess    158 INFO     Loading plugin "pylint" from entry-point.
flake8.plugins.manager    MainProcess    158 INFO     Loading plugin "quiet-filename" from entry-point.
flake8.plugins.manager    MainProcess    158 INFO     Loading plugin "quiet-nothing" from entry-point.
flake8.options.manager    MainProcess    158 WARNING  option --max-complexity: please update from optparse string `type=` to argparse callable `type=` -- this will be an error in the future
flake8.checker            MainProcess    165 INFO     Making checkers
flake8.checker            MainProcess    167 INFO     Checking 1 files
flake8.main.application   MainProcess    226 INFO     Finished running
flake8.main.application   MainProcess    226 INFO     Reporting errors

来自 the flake8 4.x changelog:

Due to constant confusion by users, user-level Flake8 configuration files are no longer supported. Files will not be searched for in the user’s home directory (e.g., ~/.flake8) nor in the XDG config directory (e.g., ~/.config/flake8)

如果您需要显式恢复以前的行为,您当然可以使用 --config ~/.config/flake8


免责声明:我是 flake8 当前的主要维护者