Is it possible to ignore one single specific line with pylint?

前端 未结 4 844
生来不讨喜
生来不讨喜 2020-11-29 00:39

I have the following line in my header:

import config.logging_settings

This actually changes my python logging settings, but pylint thinks

4条回答
  •  执笔经年
    2020-11-29 01:23

    Pylint message control is documented in the Pylint manual:

    Is it possible to locally disable a particular message?

    Yes, this feature has been added in Pylint 0.11. This may be done by adding
    # pylint: disable=some-message,another-one
    at the desired block level or at the end of the desired line of code

    You can use the message code or the symbolic names.

    For example

    def test():
        # Disable all the no-member violations in this function
        # pylint: disable=no-member
        ...
    
    global VAR # pylint: disable=global-statement
    

    The manual also has further examples.

    There is a wiki that documents all pylint messages and their codes.

提交回复
热议问题