How to run Pylint with PyCharm How to run Pylint with PyCharm python-3.x python-3.x

How to run Pylint with PyCharm


You can set up Pylint to work with PyCharm by following the following steps:

  1. Install pylint:

     $ pip install pylint
  2. Locate your pylint installation folder:

     $ which pylint         # MacOS/Linux /usr/local/bin/pylint  # This is just a possible output - check yours<!--> $ where pylint         # Windows %LocalAppData%\Programs\Python\Python36-32\Scripts\pylint.exe  # Possible location
  3. Open the PyCharm settings window with menu FileSettings, then navigate to menu ToolsExternal Tools in the sidebar. (Or search "external tools")

    PyCharm External tools

  4. Set up an external tool by clicking on the + sign and filling in the fields accordingly. In Program use the path you got when running which pylint. For the other values, you can use the same from the image.

    PyCharm Edit Tool

  5. Run pylint from menu ToolsExternal Toolspylint:

    PyCharm External Tools

  6. Look at your output in the PyCharm terminal

    PyCharm terminal

For more details, refer to Pylinting with PyCharm.

If you want to use Pylint to check your whole project or a particular file or directory, you can right click on your project root, file or directory, then activate External Toolspylint as shown below.

PyCharm check entire project


Because I didn't find a working ready-made setup, these are the settings I use in PyCharm CE 2018.1 on macOS:

1 - pip install pylint in your project virtualenv or globally

2 - Add new external tool and configure:

Program: pylintArguments: "--msg-template='{abspath}:{line:5d},{column:2d}: {msg} ({symbol})'" --output-format=colorized "$FilePath$"Working directory: $ProjectFileDir$Output filters: $FILE_PATH$:\s*$LINE$\,\s*$COLUMN$:

Notice the required double quotes for the msg-template, and the escape chars for the output filters. The output filter allows to click on the file path and open the location in the IDE source editor.

Only missing feature would be the output filters to plot the lint descriptions directly into the source view, as is done with the builtin linter. No such feature at this time though.

pylint arguments


You can try this Pylint PyCharm plugin:

Pylint PyCharm screenshot

It provides both real-time and on-demand scanning of Python files with Pylint from within PyCharm/IntelliJ IDEA.

Once you have it installed, the real-time inspection works automatically.For the on-demand you have several options that go from just checking the current open file to scan the entire project:

Enter image description here

(Just for the sake of transparency, I am the developer.)