How do I disable "TODO" warnings in pylint?

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

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

IMHO your code should not have # TODO but during development it might be needed to have TODO for a short period of time and in this case pylint will bother you. To avoid this during this time the best is to globally disable it in the pylintrc by adding fixme to the disable list like this:

[MESSAGES CONTROL]
# globally disable pylint checks (comma separated)
disable=fixme,...

So it let you the time to fix all your TODO and once this is done, you can remove the fixme from the pylintrc. Note if you use an older pylint version you will need to use W0511 instead of fixme. For more detail see https://pylint.pycqa.org/en/stable/technical_reference/features.html#messages-control-options

Changing the pylintrc notes as proposed in the first answer is a bad practice in my opinion. notes is designed to configure wich comments triggers the fixme warning and not designed to disable the warning.

Tags:

Pylint