18

In my django project I'm using an externally written app which is badly written. Now I want to ignore this app from my pylint reporting, however I can't get pylint to ignore it. Pylint is already ignoring the South migrations, like this:

[MASTER]
ignore=migrations

However, the documentation states that multiple ignores can be specified. But I've tried a few and couldn't get them to work.

Doesn't work:

[MASTER]
ignore=migrations,badapp

Also doesn't work:

[MASTER]
ignore=migrations
ignore=badapp

My project structure is like this:

|-- goodapp
|    |-- models.py
|    |-- tests.py
|    +-- views.py
|-- badapp
|    |-- models.py
|    |-- tests.py
|    +-- views.py
|-- manage.py

I'd rather not sprinkle my code with # pylint: skip-file, but rather configure pylint using the rcfile.

Bouke
  • 11,768
  • 7
  • 68
  • 102
  • I think this does not work, because pylint can't find the __init__.py file in "goodapp" and "badapp". – cwirz Nov 20 '15 at 18:51

2 Answers2

14

ignore can be set multiple times when given as a command line option, eg

pylint --ignore=migrations --ignore=badapp mymodule.py

But not in the configuration file (see the ConfigParser documentation). Though

[MASTER]
ignore=migrations,badapp

should work, if not that should be reported as a bug.

sthenault
  • 14,397
  • 5
  • 38
  • 32
  • a quick test locally makes me think that it works as expected – sthenault May 15 '13 at 09:59
  • 4
    doesn't work for me on pylint 1.3.1 (CentOS 6, Fedora 21 both have pylint 1.3.1). maybe it's a bug. I created 3 directories `a,b,c` with the same `tmp.py` and tried using a `pylintrc` with `ignore=a,b,c` and I also tried `--ignore=a,b,c`. The config file and the command line option both did not work. – Trevor Boyd Smith Mar 30 '17 at 17:35
  • --ignore= Add to the black list. It should be a base name, not a path. You may set this option multiple times. [current: %default] [Refer](https://stackoverflow.com/q/2503717/452708) – Abhijeet Aug 07 '18 at 04:29
2

You can do --ignore=migrations,badapp but not for example --ignore=lib/migrations,apps/badapp - pylint does not understand full paths, only basenames. Also in my version it ignores all multipe instances of --ignore in the command line using only the last --ignore parameter.

max
  • 29,122
  • 12
  • 52
  • 79