How to deal with Pylint's “too-many-instance-attributes” message?

后端 未结 4 1681
北恋
北恋 2021-01-31 02:10

I have just tried to lint some code with Pylint, and the last remaining error is

R0902: too-many-instance-attributes (8/7)

I understand the rat

4条回答
  •  北海茫月
    2021-01-31 02:30

    I would disable this message altogether by adding too-many-instance-attributes to the project's pylintrc or .pylintrc file as in the example below:

    [MESSAGES CONTROL]
    disable=
        locally-disabled,
        locally-enabled,
        logging-format-interpolation,
        no-init,
        too-few-public-methods,
        too-many-instance-attributes,  # <-- Ensure at least this entry.
        fixme
    

提交回复
热议问题