10

Suppose I have the following directory structure:

adir/
  __init__.py
  afile.py
bdir/
  __init__.py
  bfile.py
  adir/
    __init__.py
    afile.py

I want to run pylint on everything, except the directory bdir/adir.

Is there any way to do this? Things that do not work:

  • --ignore=bdir/adir
  • --ignore_patterns=.*bdir/adir.*
  • Any of the answers in this similar post
  • --ignore=adir (this will ignore both of the adir's - not what I want).

It seems that pylint's ignore-filters only work with the name of the file or directory, not the full path.

Is there any way to achieve this?

Peter
  • 12,274
  • 9
  • 71
  • 86
  • Here is the line that you can add in your .pylintrc file: ```--ignore= ``` https://docs.pylint.org/en/1.6.0/run.html – rom_pep Dec 18 '19 at 10:54
  • 1
    Possible duplicate of https://stackoverflow.com/questions/36182847/pylint-disable-specific-warnings-for-specific-folder?noredirect=1&lq=1 – rom_pep Dec 18 '19 at 10:59

1 Answers1

7

It should be --ignore-paths=bdir/adir. Works both on Windows and Linux.

Regarding --ignore_patterns=.*bdir/adir.*:

  • it contains typo: --ignore_patterns -> --ignore-patterns
  • according to documentation:

ignore-patterns

Files or directories matching the regex patterns are skipped. The regex matches against base names, not paths. The default value ignores emacs file locks

Default: ^.#

You specify not a base name (it includes parent folder).

Maxim Suslov
  • 4,335
  • 1
  • 35
  • 29