Can Pylint error checking be customized?

后端 未结 6 1980
名媛妹妹
名媛妹妹 2021-02-02 07:25

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

6条回答
  •  醉酒成梦
    2021-02-02 08:14

    You can globally disable warnings of a certain class using

    pylint --disable=W1234
    

    or by using a special PyLint configuration file

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

    A sample config file is given below:

    [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
    

    See the documentation over at Pylint's dedicated site.

提交回复
热议问题