如何在使用预提交时在 .py lint 中显示满足 --fail-under 要求的 .py 文件的分数?
How to display scores for meeting --fail-under requirement .py files in .py lint, while using pre-commit?
我目前的pylint
配置:
- 通过
pip
安装(在 requirements.txt 中)。
.pre-commit-config.yaml
:
- repo: local
hooks:
name: pylint
entry: pylint
language: system
types: [ python ]
files: ^src/
args:
[
"-rn", # display messages
"--rcfile=.pylintrc",
"--fail-under=8.5"
]
- 执行方式:
source venv/bin/activate &&\
pip freeze &&\
pre-commit install &&\
pre-commit run --all-files
当所有 .py 文件获得高于 8.5 的分数时,pylint
只是通过并且不显示任何消息。即使满足 --fail-under
,是否有任何方法可以查看所有通信? (所以我们知道文件有什么问题)
有一个设置会强制输出始终显示:verbose: true
但它 仅用于调试目的 因为它会使输出变得嘈杂并且您的贡献者可能会在心理上将其过滤掉,作为 警告噪声
使用您的示例:
- repo: local
hooks:
name: pylint
entry: pylint
language: system
types: [ python ]
files: ^src/
args:
[
"-rn", # display messages
"--rcfile=.pylintrc",
"--fail-under=8.5"
]
verbose: true
无关,但没有理由将 args
用于 repo: local
挂钩,因为没有任何东西可以覆盖它,您可以直接在 entry
:
中指定它们
entry: pylint --rn --rcfile=.pylintrc --fail-under=8.5
免责声明:我创建了预提交
我目前的pylint
配置:
- 通过
pip
安装(在 requirements.txt 中)。 .pre-commit-config.yaml
:
- repo: local
hooks:
name: pylint
entry: pylint
language: system
types: [ python ]
files: ^src/
args:
[
"-rn", # display messages
"--rcfile=.pylintrc",
"--fail-under=8.5"
]
- 执行方式:
source venv/bin/activate &&\
pip freeze &&\
pre-commit install &&\
pre-commit run --all-files
当所有 .py 文件获得高于 8.5 的分数时,pylint
只是通过并且不显示任何消息。即使满足 --fail-under
,是否有任何方法可以查看所有通信? (所以我们知道文件有什么问题)
有一个设置会强制输出始终显示:verbose: true
但它 仅用于调试目的 因为它会使输出变得嘈杂并且您的贡献者可能会在心理上将其过滤掉,作为 警告噪声
使用您的示例:
- repo: local
hooks:
name: pylint
entry: pylint
language: system
types: [ python ]
files: ^src/
args:
[
"-rn", # display messages
"--rcfile=.pylintrc",
"--fail-under=8.5"
]
verbose: true
无关,但没有理由将 args
用于 repo: local
挂钩,因为没有任何东西可以覆盖它,您可以直接在 entry
:
entry: pylint --rn --rcfile=.pylintrc --fail-under=8.5
免责声明:我创建了预提交