我使用项目根目录中的.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发布于 2017-10-02 09:20:54
若要跨几行指定disable,请使用以下命令:
disable=relative-import,
invalid-name,
missing-docstring这就是:
\;和发布于 2019-10-17 04:54:35
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"如果你能让别人停用,比如,我的项目,皮林特给我这个信息,
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那潘林特不报告三条消息
https://stackoverflow.com/questions/46522592
复制相似问题