如何在pylint中禁用"Using config file"

How to disable "Using config file" in pylint

我是 运行 使用简单 bash 脚本的几个目录的 pylint:

#!/usr/bin/env bash

set -e

for PACKAGE in some_dir another_dir third_dir
do
    pylint --disable=R,C $PACKAGE
done

如果一切正常,我希望输出是干净的。然而,有烦人的台词:

Using config file /home/user/projects/some-project/.pylintrc

pylintrcpylint 命令行中是否有禁用 "Using config file" 的选项?

更新: 有一个未解决的问题 https://github.com/PyCQA/pylint/issues/1853

如果它仍然与任何人相关,这个 PR to pylint 可以解决问题。从 pylint 2.0 您可以将 --quiet 标志传递给 pylint.

编辑:如果您使用较旧的 pylint,您可以使用 grep:
重定向和排除 pylint 2>&1 | grep -v "Using config file"

@Jan Jurec answer is outdated, in a posterior commit,他们将安静命令标志重命名为 --verbose。现在,pylint 默认为 "quiet"。

然而,它仍然不够安静,因为默认情况下它会像这样打印分数:

D:\tests>pylint --disable=I,E,R,W,C,F --enable=E0102 --reports=no test.py

---------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: -2.50/10, +12.50)


D:\tests>

但是你用-sn禁用了那些,那么当没有发现问题时,旧的例子就会变成这样:

D:\tests>pylint --disable=I,E,R,W,C,F --enable=E0102 --reports=no -sn test.py
D:\tests>

如果发现问题,输出将是这样的:

D:\tests>pylint --disable=I,E,R,W,C,F --enable=E0102 --reports=no -sn test.py
************* Module test
test.py:6:0: E0102: class already defined line 3 (function-redefined)
D:\tests>

而不是这个默认值:

D:\tests>pylint --disable=I,E,R,W,C,F --enable=E0102 --reports=no test.py
************* Module test
test.py:6:0: E0102: class already defined line 3 (function-redefined)

---------------------------------------------------------------------
Your code has been rated at -2.50/10 (previous run: 10.00/10, -12.50)


D:\tests>

参考资料

  1. pylint: error: no such option: --quiet
  2. Still not quiet enough