当前位置: 首页 > 工具软件 > Pylint > 使用案例 >

Pylint pylint设置不检查项

陆昕
2023-12-01

摘要:https://www.manongdao.com/article-1002862.html

设置pylint忽略某个文件不进行检查

对external.py不检查,在文件中设置: # pylint: skip-file

# -*- coding: utf-8 -*-
# @Time    : 2021/5/17 15:18
# @File    : external.py
# @Software: PyCharm
# pylint: skip-file

from pysdk.first_layer import BaseLayer

class Events(BaseLayer):
    def __init__(self):
        # pylint: disable=C0115
        super(Events, self).__init__()

class Metrics(BaseLayer):
    def __init__(self):
        super(Metrics, self).__init__()

设置pylint忽略文件中执行类型(C,R,W,E,F)不进行检查

对external.py中’W’类型不检查,在文件中设置: # pylint: disable=W

# -*- coding: utf-8 -*-
# @Time    : 2021/5/17 15:18
# @File    : external.py
# @Software: PyCharm
# pylint: disable=W

from pysdk.first_layer import BaseLayer

class Events(BaseLayer):
    def __init__(self):
        super(Events, self).__init__()

class Metrics(BaseLayer):
    def __init__(self):
        super(Metrics, self).__init__()

设置pylint忽略文件中某个函数执行类型(C,R,W,E,F)不进行检查

对external.py中’W,R,E’类型不检查,在文件中类下函数或普通函数下设置: # pylint: disable=W,E,R

# -*- coding: utf-8 -*-
# @Time    : 2021/5/17 15:18
# @File    : external.py
# @Software: PyCharm
from pysdk.first_layer import BaseLayer

class Events(BaseLayer):
    def __init__(self):
        # pylint: disable=W,R,E
        super(Events, self).__init__()
    def __init__(self):
        super(Events, self).__init__()

class Metrics(BaseLayer):
    def __init__(self):
        super(Metrics, self).__init__()

设置pylint忽略文件中某个类执行类型(C,R,W,E,F)不进行检查

对external.py中’W,R,E’类型不检查,在文件中类下面设置: # pylint: disable=W,E,R

# -*- coding: utf-8 -*-
# @Time    : 2021/5/17 15:18
# @File    : external.py
# @Software: PyCharm
from pysdk.first_layer import BaseLayer

class Events(BaseLayer):
    # pylint: disable=W,R,E
    def __init__(self):
        super(Events, self).__init__()
    def __init__(self):
        super(Events, self).__init__()

class Metrics(BaseLayer):
    def __init__(self):
        super(Metrics, self).__init__()

在命令行中使用pylint: disable=W

$ pylint --disable=W external.py

在pylint配置文件中使用pylint: disable=W

# 生成pyLintrc.conf
pylint --generate-rcfile > pyLintrc.conf

# vim pyLintrc.conf 修改配置文件
[MESSAGES CONTROL]
disable=W
 类似资料: