7

I have a file foo.py that makes extensive use of the Faker third-party module. As such, pylint generates a lot of 'no-member' errors.

I would like to disable these in foo.py. So at the top, I tried inserting:

# pragma pylint: disable=no-member

But, in a quite-annoying fashion, pylint now spits out a suppressed message every time it hits one of these errors - completely defeating the purpose of my pragma??

foo.py:1:0: I0011: Locally disabling no-member (E1101) (locally-disabled)
... other misc stuff ...
foo.py:177:0: I0020: Suppressed 'no-member' (from line 1) (suppressed-message)
foo.py:83:0: I0020: Suppressed 'no-member' (from line 1) (suppressed-message)
foo.py:85:0: I0020: Suppressed 'no-member' (from line 1) (suppressed-message)

Huh... well that's... ridiculous.

So I tried to... suppress the suppression messages??

# pragma pylint: disable=no-member,suppressed-message

And THEN it gets even better...

foo.py:1:0: I0011: Locally disabling no-member (E1101) (locally-disabled)
foo.py:1:0: I0011: Locally disabling suppressed-message (I0020) (locally-disabled)
foo.py:1:0: C0102: Black listed name "foo" (blacklisted-name)
.... misc stuff, actual things I should clean up here ...
foo.py:1:0: I0021: Useless suppression of 'suppressed-message' (useless-suppression)

So I guess my question is - how do I make suppression messages go away entirely on a per-file basis, without some annoying replacement message being dropped in?

EDIT: Thank you for the comments.

Output of pylint --version:

pylint 2.1.1
astroid 2.0.4
Python 3.6.5 (default, Apr 25 2018, 14:23:58) 
[GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.1)]
8
  • 5
    Useless suppression of 'suppressed-message' (useless-suppression) ...hilarious!
    – wim
    Sep 21, 2018 at 18:31
  • What's your Pylint version? Have you tried updating it? I0020 and I0021 are supposed to be suppressed by default. Sep 21, 2018 at 18:36
  • 4
    Resistance is futile, your suppression will be suppressed.
    – PM 2Ring
    Sep 21, 2018 at 18:38
  • If your Pylint is up to date, you may have accidentally configured it to unsuppress those messages. Sep 21, 2018 at 18:38
  • 2
    I recommend this method of configuring pylint: pip uninstall -y pylint (it has never bugged me since)
    – wim
    Sep 21, 2018 at 19:00

1 Answer 1

4

I-category messages are disabled by default. You turned them on yourself, by setting enable=all in the [MESSAGES CONTROL] section of your pylintrc, and then you didn't disable them in the disable list in the same section. Add suppressed-message to the disable list in your pylintrc, and the suppressed-message messages should stop appearing.

As for the useless-suppression message, that seems to be a pylint bug.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.