PyCharm has it’s own built-in linting, which is already useful and nicely integrated. However, it misses much that PyLint catches.
In this post I explain how I integrate PyLint into PyCharm as an external tool, with links from the PyLint results back to the python file.
Setting up PyLint as an External Tool in PyCharm
- Install PyLint and create a .pylintrc file (Reference: The docs).
- Setup PyCharm to run PyLint as an external tool (Reference: Stack Overflow)
- Edit the .pylintrc file to configure PyLint to print the full file path and line number as shown (The docs)
4. Configure PyCharm output filters to: .*$FILE_PATH$\:$LINE$\:.*
Then it will recognize filename:line_number as a link
Output Filter configuration is shown at the bottom of this picture:
5. Run your external tool and check that it works as expected, including the links:
- Create several levels of PyLinting:
I generally lint for Errors and Warn/Refactor often, and only lint for Convention after the changes to a python file (that I’ll keep using) are several days old (and hence more stable).
- The Grep console plugin can add some nice highlighting
- I often work from the bottom PyLint link up, so that the earlier links still point to the correct lines.