Python 如何指定pylintrc配置值,每行一个?
我在项目根目录中使用Python 如何指定pylintrc配置值,每行一个?,python,pylint,pylintrc,Python,Pylint,Pylintrc,我在项目根目录中使用.pylintrc来控制在项目上运行时收到的PyLint消息 pylintrc中有许多选项采用逗号分隔的值列表。例如: [MASTER] disable=relative-import,invalid-name,missing-docstring 在我实际的pylintrc中,这个值列表可能相当长是否有办法指定这些值,每行一个? 这不起作用: disable=relative-import,\ invalid-name,\ missing-docstring 这也不起作
.pylintrc
来控制在项目上运行时收到的PyLint消息
pylintrc中有许多选项采用逗号分隔的值列表。例如:
[MASTER]
disable=relative-import,invalid-name,missing-docstring
在我实际的pylintrc中,这个值列表可能相当长是否有办法指定这些值,每行一个?
这不起作用:
disable=relative-import,\
invalid-name,\
missing-docstring
这也不起作用:
disable=relative-import
disable+=invalid-name
disable+=missing-docstring
要跨多行指定
禁用
,请使用以下命令:
disable=relative-import,
invalid-name,
missing-docstring
即:
- 无连续字符
;及\
- 缩进后面的行
禁用
,请使用以下命令:
disable=relative-import,
invalid-name,
missing-docstring
即:
- 无连续字符
;及\
- 缩进后面的行
- Em,您可以逐行添加配置,我正在我的项目中使用它
pylint将关键字
disable
解释为:
# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifiers separated by comma (,) or put this
# option multiple times (only on the command line, not in the configuration
# file where it should appear only once).You can also use "--disable=all" to
# disable everything first and then reenable specific checks. For example, if
# you want to run only the similarities checker, you can use "--disable=all
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
如果你可以禁用其他人,例如,im我的项目,pylint给我这些信息
C0116: Missing function or method docstring (missing-function-docstring)
R0201: Method could be a function (no-self-use)
R1705: Unnecessary "elif" after "return" (no-else-return)
但我想忽略三条消息,所以我将它们添加到disable
标记中,如下所示
disable=unnecessary-lambda,
no-else-return,
too-many-branches
然后pylint不报告这三条消息,你可以一行一行地添加你的配置,我正在我的项目中使用它 pylint将关键字
disable
解释为:
# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifiers separated by comma (,) or put this
# option multiple times (only on the command line, not in the configuration
# file where it should appear only once).You can also use "--disable=all" to
# disable everything first and then reenable specific checks. For example, if
# you want to run only the similarities checker, you can use "--disable=all
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
如果你可以禁用其他人,例如,im我的项目,pylint给我这些信息
C0116: Missing function or method docstring (missing-function-docstring)
R0201: Method could be a function (no-self-use)
R1705: Unnecessary "elif" after "return" (no-else-return)
但我想忽略三条消息,所以我将它们添加到disable
标记中,如下所示
disable=unnecessary-lambda,
no-else-return,
too-many-branches
然后pylint不报告这三条消息这是使用字段:字段正文
格式的标准python格式这是使用字段:字段正文
格式的标准python格式