Choosing messages
pylint -E <path>
Report errors only (--errors-only)
pylint --disable=<msg>[,<msg>]
Turn messages off by id or symbol
pylint --enable=<msg>
Turn a message back on
pylint --disable=all --enable=<msg>
Run only the listed messages
pylint --disable=C,R <path>
Disable whole categories (C, R, W, E, F)
Output and score
pylint --fail-under=<score> <path>
Exit non-zero if the score is below it
pylint --score=n <path>
Hide the 0-10 score (--score=n)
pylint -f json2 <path>
Machine-readable JSON output
pylint --msg-template='<tmpl>'
Custom line, e.g. '{path}:{line}: {msg_id} {msg}'
pylint --exit-zero <path>
Always exit 0, even with findings
Configuration
pylint --rcfile=<file> <path>
Use a specific config file
pylint --generate-toml-config
Print a documented pyproject-style config
pylint --generate-rcfile
Print a documented .pylintrc
Both generators include the effect of the other options you
pass, so pylint --disable=C0114 --generate-rcfile bakes it in.
pyproject.toml: [tool.pylint.main]
Project-wide settings (jobs, ignore-paths)
[tool.pylint."messages control"]
disable / enable lists in pyproject.toml
[tool.pylint.format] max-line-length = <n>
Change the line length limit (default 100)
[tool.pylint.basic] good-names = [<names>]
Allow short names like i, df, x
Messages you will meet
C0114 / C0115 / C0116
Missing module / class / function docstring
C0103 invalid-name
Name breaks the naming style
C0301 line-too-long
Line exceeds max-line-length
W0611 unused-import
Imported but never used
W0612 / W0613
Unused variable / unused argument
E0401 import-error
Module cannot be imported (wrong env?)
E1101 no-member
Attribute not found on inferred type
E0602 undefined-variable
Name is not defined
W0102 dangerous-default-value
Mutable default argument
W0718 broad-exception-caught
except Exception is too general
W1203 logging-fstring-interpolation
Use lazy %s formatting in logging calls
R1705 no-else-return
else after return is unnecessary
R0913 too-many-arguments
More arguments than max-args (default 5)
R0902 / R0912 / R0914 / R0915
Too many attributes / branches / locals / statements