Pylint和预提交python 3.7 [英] Pylint and pre-commit python 3.7

查看:57
本文介绍了Pylint和预提交python 3.7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置pylint与pre-commit一起使用.我已经研究过文档,但仍然感到困惑.我不知道如何正确设置.pre-commit-config.yaml.

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

推荐答案

最基本的模板可能是这样:

The most basic possible template would be this:

-   repo: https://github.com/pycqa/pylint
    rev: pylint-2.6.0
    hooks:
    -   id: pylint

您还可以将参数传递给pylint:

You can also pass arguments to pylint:

-   repo: https://github.com/pycqa/pylint
    rev: pylint-2.6.0
    hooks:
    -   id: pylint
        args:
        - --max-line-length=80
        - --ignore-imports=yes
        - -d duplicate-code

有关兼容性的注意事项:

Notes about compatibility:

  • Python> = 3.7需要pylint> = 2.0
  • Python 2需要pylint<2.0(Python 2支持为放在Pylint 2中)

这篇关于Pylint和预提交python 3.7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆