In Pylint, can I override global message control based on filename?

421 views Asked by At

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)

1

There are 1 answers

3
gore On

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.