3

I use a pylintrc file to disable some pylint warnings project-wide, but I'd like to disable some more messages just for files named SConscript.

Currently, I have a # pylint: disable=... in the beginning of each SConscript file, but it's a pain to maintain.

Is there a way to tell pylint to have extra suppressions based on the processed filename? (or regex, or whatever)

gore
  • 551
  • 2
  • 20
Itamar
  • 1,089
  • 1
  • 10
  • 18

1 Answers1

-1

Solution to setup in your pylintrc config file this setting:

# Add files or directories matching the regex patterns to the blacklist. The
# regex matches against base names, not paths.
# Ignore all .py files under the 3rdparty subdirectory.
ignore-patterns=SConscript,**/3rdparty/**/*.py,.venv

With this setting pylint scan will ignore the filename/directory/packagename patterns you setup here.

gore
  • 551
  • 2
  • 20
  • 2
    The question was about disabling "*based on the filename*". The OP already has `pylint: disable` at the beginning of the target files, but "*it's a pain to maintain*". – Gino Mempin Dec 22 '20 at 00:48
  • Thank you, now i see this. I will edit my answer to a proper now. Update: finished! – gore Dec 22 '20 at 01:00
  • 2
    Thanks for the suggestion. This seems to work well for ignoring a file entirely. What I was looking for is ignoring based on a combination of file pattern and rule pattern (e.g. "ignore all `undefined-variable` errors in files that match pattern `SConscript`") – Itamar Dec 22 '20 at 17:37