[英]Flake8: how to select all lints
According to: https://flake8.pycqa.org/en/6.0.0/user/options.html#cmdoption-flake8-select根据: https://flake8.pycqa.org/en/6.0.0/user/options.html#cmdoption-flake8-select
--select=<errors> --select=<错误>
Specify the list of error codes you wish Flake8 to report.指定您希望 Flake8 报告的错误代码列表。 Similarly to --ignore.与 --ignore 类似。 You can specify a portion of an error code to get all that start with that string.您可以指定错误代码的一部分以获取所有以该字符串开头的错误代码。 For example, you can use E, E4, E43, and E431.例如,您可以使用 E、E4、E43 和 E431。
This defaults to: E,F,W,C90默认为:E、F、W、C90
I'm currently using:我目前正在使用:
select = B,C,E,F,W,T4,B9,N8,E4 select = B,C,E,F,W,T4,B9,N8,E4
My question is: is there any shortcut to select all lints?我的问题是: select all lints 是否有任何快捷方式? . . I want this to write a bot (POC) to auto report issues (possibly ignoring project preferences) and I don't want to launch a new version of bot if a new select was added to flake8.我希望这可以编写一个机器人 (POC) 来自动报告问题(可能忽略项目首选项),如果将新的 select 添加到 flake8,我不想启动新版本的机器人。
I'm expecting something simple like --select='*'
我期待一些简单的东西,比如--select='*'
Just don't use --select at all.根本不要使用--select。 By default it will select all the errors to test for linting.默认情况下,它将 select 所有错误进行 linting 测试。 In general, use --select only if you know specifically which errors you want to test, and use --ignore only if there are specific tests you don't want to run.通常,仅当您明确知道要测试哪些错误时才使用 --select,而仅当有您不想运行的特定测试时才使用 --ignore。
to select all errors and disable all off-by-default errors while ignoring the configuration you need to combine two options:到 select 所有错误并禁用所有默认关闭错误,同时忽略您需要组合两个选项的配置:
--isolated
: ignore the configuration --isolated
: 忽略配置--ignore=
: reset the ignore list to be empty --ignore=
: 将忽略列表重置为空you do not need to adjust --select
as it will contain everything by default您不需要调整--select
因为它默认包含所有内容
you would also need to find any off_by_default = True
plugins and enable each of them through --enable-extensions
您还需要找到任何off_by_default = True
插件并通过--enable-extensions
启用它们
note that this doesn't necessarily turn on all errors as plugins can decide whether to report things based on other conditions.请注意,这不一定会打开所有错误,因为插件可以根据其他条件决定是否报告内容。 the builtin mccabe
plugin for instance will not report C90
unless --max-complexity
is specified and pycodestyle
will not report (idk the error code because I think it's a bad one) unless --max-doc-length
is specified例如,内置的mccabe
插件不会报告C90
,除非指定了--max-complexity
并且pycodestyle
不会报告(idk 错误代码,因为我认为这是一个错误代码)除非指定了--max-doc-length
disclaimer: I maintain flake8 and a few plugins免责声明:我维护 flake8 和一些插件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.