问题
I am trying to set up pylint to work with pre-commit. I have looked into the docs, but still I am confused. I do not know how to setup .pre-commit-config.yaml properly.
Could you provide the most basic possible template?
- repo: myrepo
rev: '' # Don't know that to type here
hooks:
- id: pylint
回答1:
The most basic possible template would be this:
- repo: https://github.com/pre-commit/mirrors-pylint
rev: v2.3.1
hooks:
- id: pylint
You can also pass arguments to pylint:
- repo: https://github.com/pre-commit/mirrors-pylint
rev: v2.3.1
hooks:
- id: pylint
args:
- --max-line-length=80
- --ignore-imports=yes
- -d duplicate-code
Notes about compatibility:
- Python >=3.7 requires pylint >= 2.0
- Python 2 requires pylint < 2.0 (Python 2 support was dropped in Pylint 2)
来源:https://stackoverflow.com/questions/55023087/pylint-and-pre-commit-python-3-7