samuelbrody1249
samuelbrody1249

Reputation: 4767

Where to get all pylint warning/error codes?

Is there a place where I can get all pylint codes that are used for warning/error messages?

When I tried searching the pylint site for something like "C0114" (missing-module-docstring) I get no search results:

enter image description here

Where can I find all of these?

Looking in the code itself, it seems like they are scattered throughout all the files, so it would be nice to have a nice table showing all the possible codes if there's something like that possible:

.//pylint/checkers/strings.py:            "W1401": (
.//pylint/checkers/strings.py:            "W1402": (
.//pylint/checkers/strings.py:            "W1404": (
.//pylint/checkers/strings.py:            "W1405": (
.//pylint/extensions/empty_comment.py:    "R2044": (
.//pylint/extensions/broad_try_clause.py: "W0717": (
.//pylint/extensions/docparams.py:        "W9005": (
.//pylint/extensions/docparams.py:        "W9006": (
.//pylint/extensions/docparams.py:        "W9008": (
.//pylint/extensions/docparams.py:        "W9010": (
...etc

Upvotes: 7

Views: 5487

Answers (2)

samuelbrody1249
samuelbrody1249

Reputation: 4767

There are two ways you might want to get this:

  1. To list all messages you can do:

    $ pylint --list-msgs
    :exception-escape (W1661): *Using an exception object that was bound by...
    :comprehension-escape (W1662): *Using a variable that was bound inside a...
    
  2. If you know the name of a specific message and want to look up its code you can do the above with the help of grep:

    $ pylint --list-msgs |grep trailing-newlines
    :trailing-newlines (C0305): *Trailing newlines*
    

Upvotes: 9

PyLint documentation is almost as bad as its diagnostics - for PyLint 1.6.5 (which is ancient btw) the codes seem to be listed in Pylint features - likewise for latest release.

Upvotes: 6

Related Questions