Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I disable "TODO" warnings in pylint?

Tags:

When running pylint on a python file it shows me warnings regarding TODO comments by default. E.g.:

************* Module foo
W:200, 0: TODO(SE): fix this! (fixme)
W:294, 0: TODO(SE): backlog item (fixme)
W:412, 0: TODO(SE): Delete bucket? (fixme)

While I do find this behavior useful, I would like to know of a way of temporarily and/or permanently turn these specific warnings on or off.

I am able to generate a pylint config file: pylint --generate-rcfile > ~/.pylintrc

I'm just note sure what to put in this file to disable warnings for TODO comments.

like image 359
sedwards Avatar asked Oct 15 '15 20:10

sedwards


People also ask

How do I turn off Pylint warnings?

This may be done by adding # pylint: disable=some-message,another-one at the desired block level or at the end of the desired line of code.

How do I get Pylint to ignore a file?

If you want to disable specific warnings only, this can be done by adding a comment such as # pylint: disable=message-name to disable the specified message for the remainder of the file, or at least until # pylint: enable=message-name .


Video Answer


2 Answers

in the generated config file, you should see a section

  [MISCELLANEOUS]    # List of note tags to take in consideration, separated by a comma.   notes=FIXME,XXX,TODO 

simply drop TODO from the "notes" list.

The config file is found at

~/.pylintrc 

If you have not generated the config file, this can be done with

pylint --generate-rcfile > ~/.pylintrc 
like image 141
sthenault Avatar answered Sep 23 '22 23:09

sthenault


Along with the solution posted by @sthenault where you could disable all warnings, Pylint also allows you to ignore a single line (helpful if you would want to deal with it in the future) like so:

A_CONSTANT = 'ugh.'  # TODO: update value  # pylint: disable=fixme 

or by stating the Rule ID:

A_CONSTANT = 'ugh.'  # TODO: update value  # pylint: disable=W0511 
like image 21
captainblack Avatar answered Sep 21 '22 23:09

captainblack