Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pylint: Exclude directory

Tags:

python

pylint

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?

like image 997
Peter Avatar asked Nov 16 '22 03:11

Peter


1 Answers

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).

like image 154
Maxim Suslov Avatar answered Dec 04 '22 05:12

Maxim Suslov