Pylint and pre-commit python 3.7

两盒软妹~` 提交于 2020-05-13 21:20:25

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!