15

I'm using South for migration in my Django project. When I run Pylint on my project I get a bunch of errors from the migration files. How can I exclude migration files from Pylint?

I'm on a Windows system so I can't use filename exclusions in the Pylint options. I've tried to resort to adding # pylint: disable-msg-cat=WCREFI to the top of each of my migration files. It seems very kludgy and seems to be the last resort but this documented directive doesn't work and I get the error [E] Unrecognized file option 'disable-msg-cat'.

Francisco
  • 10,918
  • 6
  • 34
  • 45
Mridang Agarwalla
  • 43,201
  • 71
  • 221
  • 382

4 Answers4

22

Adding the following to the .pylintrc file did it.

[MASTER]

# Add <file or directory> to the black list. It should be a base name, not a
# path. You may set this option multiple times.
ignore=tests.py, urls.py, migrations
Mridang Agarwalla
  • 43,201
  • 71
  • 221
  • 382
2
# .pylintrc
ignore-patterns=\d{4}_.*?.py
infinito84
  • 1,971
  • 17
  • 8
  • While this code may solve the question, [including an explanation](//meta.stackexchange.com/q/114762) of how and why this solves the problem would really help to improve the quality of your post, and probably result in more up-votes. Remember that you are answering the question for readers in the future, not just the person asking now. Please [edit] your answer to add explanations and give an indication of what limitations and assumptions apply. [From Review](/review/low-quality-posts/25983565) – double-beep Apr 29 '20 at 08:42
2

The anser here didn't work for me, the ignore list doesn't work on directories. I had to add

ignore-paths=.*/migrations

Jens Timmerman
  • 9,316
  • 1
  • 42
  • 48
1

In recent pylint versions, disable-msg-cat has been unified with other disable-* options as a single 'disable' option. Since then,

# pylint: disable=I,E,R,F,C

may be added on top of files where you don't want any messages issued.

sthenault
  • 14,397
  • 5
  • 38
  • 32