【发布时间】:2021-04-15 21:06:45
【问题描述】:
我正在尝试将 flakehell 作为预提交挂钩运行。
我的 .pre-commit-config.yaml:
repos:
- repo: local
hooks:
- id: flakehell
name: flakehell
entry: flakehell lint project/
language: python
pass_filenames: true
stages: [push, commit]
verbose: true
pyproject.toml:
[tool.flakehell]
exclude = ["README.md"]
format = "colored"
show_source = true
[tool.flakehell.plugins]
flake8-bandit = ["+*", "-S322"]
flake8-bugbear = ["+*"]
flake8-builtins = ["+*"]
flake8-comprehensions = ["+*"]
flake8-darglint = ["+*"]
flake8-docstrings = ["+*"]
flake8-eradicate = ["+*"]
flake8-isort = ["+*"]
flake8-mutable = ["+*"]
flake8-pytest-style = ["+*"]
flake8-spellcheck = ["+*"]
mccabe = ["+*"]
pep8-naming = ["+*"]
pycodestyle = ["+*"]
pyflakes = ["+*"]
pylint = ["+*"]
还有一些问题。当我尝试使用 git commit 时,我看到 flakehell 开始工作。几秒钟后它失败了,我得到了错误:
“UnicodeDecodeError: 'utf-8' 编解码器无法解码位置 10 中的字节 0xb8: 无效起始字节”
没有“预提交”它会很好用(我的意思是当我只输入“flakehell lint”时)
是否可以将 flakehell 配置为预提交?
如果没有 - 您是否为 python 项目推荐任何更好/有效的解决方案?
【问题讨论】:
-
小改进:您可以使用
entry: flake8helld,这是一个flake8包装器。
标签: python git pre-commit pre-commit.com