Pylint 错误检查可以自定义吗? [英] Can Pylint error checking be customized?

查看:65
本文介绍了Pylint 错误检查可以自定义吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 pydev,我在其中设置了 pylint.问题是,即使在评论中,pylint 也会报告警告.我希望在任何行或块注释中禁用任何类型的检查.另外,我希望在我的代码中遵循驼峰命名约定而不是变量和参数的下划线.有没有办法指定这样的规则而不用任何pylint插入我的代码:禁用注释?

I am using pydev where I have set up pylint. The problem is that even inside the comments, pylint reports warnings. I was looking to disable any sort of checking inside any line or a block comment. Also, I wish to follow camelCase naming convention instead of underscores for variables and arguments in my code. Is there any way to specify such a rule without inserting my code with any pylint: disable comments?

推荐答案

您可以使用

pylint --disable=W1234

或使用特殊的 PyLint 配置文件

or by using a special PyLint configuration file

pylint --rcfile=/path/to/config.file

示例配置文件如下:

[MESSAGES CONTROL]
# C0111 Missing docstring 
# I0011 Warning locally suppressed using disable-msg
# I0012 Warning locally suppressed using disable-msg
# W0704 Except doesn't do anything Used when an except clause does nothing but "pass" and there is no "else" clause
# W0142 Used * or * magic* Used when a function or method is called using *args or **kwargs to dispatch arguments.
# W0212 Access to a protected member %s of a client class
# W0232 Class has no __init__ method Used when a class has no __init__ method, neither its parent classes.
# W0613 Unused argument %r Used when a function or method argument is not used.
# W0702 No exception's type specified Used when an except clause doesn't specify exceptions type to catch.
# R0201 Method could be a function
# W0614 Unused import XYZ from wildcard import
# R0914 Too many local variables
# R0912 Too many branches
# R0915 Too many statements
# R0913 Too many arguments
# R0904 Too many public methods
disable=C0111,I0011,I0012,W0704,W0142,W0212,W0232,W0613,W0702,R0201,W0614,R0914,R0912,R0915,R0913,R0904,R0801

请参阅 文档"noreferrer">Pylint 的专用网站.

See the documentation over at Pylint's dedicated site.

这篇关于Pylint 错误检查可以自定义吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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