Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork1.2k
It's not just a linter that annoys you!
License
pylint-dev/pylint
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Pylint is astatic code analyser for Python 2 or 3. The latest version supports Python3.10.0 and above.
Pylint analyses your code without actually running it. It checks for errors, enforces acoding standard, looks forcode smells, and can make suggestions about how the codecould be refactored.
For command line use, pylint is installed with:
pip install pylint
Or if you want to also check spelling withenchant
(you might need toinstall the enchant C library):
pip install pylint[spelling]
It can also be integrated in most editors or IDEs. More information can be foundin the documentation.
Pylint is not trusting your typing and is inferring the actual values of nodes (for astart because there was no typing when pylint started off) using its internal coderepresentation (astroid). If your code isimport logging as argparse
, Pylintcan check and know thatargparse.error(...)
is in fact a logging call and not anargparse call. This makes pylint slower, but it also lets pylint find more issues ifyour code is not fully typed.
[inference] is the killer feature that keeps us using [pylint] in our project despite how painfully slow it is.-Realist pylint user, 2022
pylint, not afraid of being a little slower than it already is, is also a lot more thorough than other linters.There are more checks, including some opinionated ones that are deactivated by defaultbut can be enabled using configuration.
Pylint isn't smarter than you: it may warn you about things that you haveconscientiously done or check for some things that you don't care about.During adoption, especially in a legacy project where pylint was never enforced,it's best to start with the--errors-only
flag, then disableconvention and refactor messages with--disable=C,R
and progressivelyre-evaluate and re-enable messages as your priorities evolve.
Pylint is highly configurable and permits to write plugins in order to add yourown checks (for example, for internal libraries or an internal rule). Pylint also has anecosystem of existing plugins for popular frameworks and third-party libraries.
Note
Pylint supports the Python standard library out of the box. Third-partylibraries are not always supported, so a plugin might be needed. A good placeto start isPyPI
which often returns a plugin by searching forpylint <library>
.pylint-pydantic,pylint-django andpylint-sonarjson are examples of such plugins. More information about pluginsand how to load them can be found atplugins.
Projects that you might want to use alongside pylint includeruff (really fast,with builtin auto-fix and a large number of checks taken from popular linters, butimplemented inrust
) orflake8 (a framework to implement your own checks in python usingast
directly),mypy,pyright / pylance orpyre (typing checks),bandit (security oriented checks),black andisort (auto-formatting),autoflake (automated removal of unused imports or variables),pyupgrade(automated upgrade to newer python syntax) andpydocstringformatter (automated pep257).
Pylint ships with two additional tools:
- pyreverse (standalone tool that generates package and class diagrams.)
- symilar (duplicate code finder that is also integrated in pylint)
We welcome all forms of contributions such as updates for documentation, new code, checking issues for duplicates or telling usthat we can close them, confirming that issues still exist,creating issues becauseyou found a bug or want a feature, etc. Everything is much appreciated!
Please follow thecode of conduct and checkthe Contributor Guides if you want tomake a code contribution.
You can place this badge in your README to let others know your project uses pylint.
Learn how to add a badge to your documentation inthe badge documentation.
pylint is, with a few exceptions listed below,GPLv2.
The icon files are licensed under theCC BY-SA 4.0 license:
Please checkthe contact information.
![]() | Professional support for pylint is available as part of theTideliftSubscription. Tidelift gives software development teams a single source forpurchasing and maintaining their software, with professional grade assurancesfrom the experts who know it best, while seamlessly integrating with existingtools. |
About
It's not just a linter that annoys you!
Topics
Resources
License
Code of conduct
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.