class MyFavoriteClass():
def __init__(self):
self.counter = 0
def memberFunction(self):
self.counter = self.counter + 1
myinstance = MyFavoriteClass() #Pylint complains here
myinstance.memberFunction()
pylint报告的第二行到最后一行的错误是
^{pr2}$我已经读到完全禁用这种类型的错误是可能的,但是有必要吗?在
我怎样才能告诉pylint myinstance不是常量?在
pylint-v报告的系统配置
pylint 0.26.0,
astng 0.24.1, common 0.59.1
Python 2.7.5+ (default, Sep 19 2013, 13:48:49)
[GCC 4.8.1]
使用pylint,您可以通过使用格式为
# pylint: disable={comma-separated-list-of-names-or-codes}
的特殊注释来忽略行上的单个错误、警告等或者,可以在pylint配置文件中指定要忽略的消息代码列表:
^{pr2}$注意:从配置文件中禁用代码将全局忽略它。如果你想在某一行忽略它,你必须使用开头提到的特殊注释。在
pylint配置文件通过首先检查}将被连续检查。在
PYLINTRC
环境变量来确定。如果它不提供文件,那么~/.pylintrc
和{如果您可以控制正在执行的pylint命令,那么还可以使用
rcfile
参数指定配置。在如果要生成示例配置,请运行:
另外,如果您禁用一个代码,它将触发^{} ,它本身也可以被禁用(最好是在配置中)。在
相关问题 更多 >
编程相关推荐