Sum*_*sht 33 python pylint pydev
我正在使用pydev,我已经设置了pylint.问题是即使在评论中,pylint也会报告警告.我希望在任何行或块注释中禁用任何类型的检查.另外,我希望在我的代码中遵循camelCase命名约定而不是下划线中的变量和参数.有没有办法指定这样的规则而不用任何pylint插入我的代码:禁用评论?
cfe*_*ann 46
您可以使用全局禁用某个类的警告
pylint --disable=W1234
Run Code Online (Sandbox Code Playgroud)
或者使用特殊的PyLint配置文件
pylint --rcfile=/path/to/config.file
Run Code Online (Sandbox Code Playgroud)
下面给出了一个示例配置文件:
[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
Run Code Online (Sandbox Code Playgroud)
见文档上的pylint的专设网站.
sth*_*ult 19
正如cfedermann所说,您可以在~/.pylintrc文件中指定要禁用的消息(注意,pylint --generate-rcfile如果您不想使用内联注释,则可以使用生成存根文件.
您还可以在生成的文件中,在[BASIC]部分中看到诸如"method-rgx","function-rgx"等选项,您可以配置它们以支持驼峰案例样式而不是pep8下划线样式.