PyCharm and external lint tools

PyCharm already has a number of features present in various tools to lint/check your source code with, but offers a way to hook up external tools. Under File > Settings is a section called IDE Settings. One of the headings here is called External Tools. Select this heading and then press the Add... button on the right hand pane to configure a new external tool.

In the Edit Tool window that now appeared fill in a name, e.g. PEP8 and a group name Lint and add a description. Next point the Program to the location of the pep8.exe executable, e.g. C:\Python27\Scripts\pep8.exe. For Parameters you need to use $FilePath and Working directory should be filled in by default. Once done, you can close it by pressing the OK button.

Now, pyflakes has no .exe or .bat file to accompany it. You will need to add a pyflakes.bat in your Scripts directory inside Python with the following contents:

@echo off
rem Use python to execute the python script having the same name as this batch
rem file, but without any extension, located in the same directory as this
rem batch file
python "%~dpn0" %*

Within PyCharm you follow largely the same settings as for pep8, however make sure to point to the batch file of pyflakes under Program. Close the external tools configuration windows by clicking OK twice. Under the menu heading Tools you should see an submenu heading Lint which, in turn, should contain two menu items: PEP8 and Pyflakes.

Now open a Python file, go to Tools > Lint > PEP8 and you should get output like the following in your Run (4) window:

D:\Python26\Scripts\pep8.exe D:\pprojects\babel\babel\tests\__init__.py
D:\pprojects\babel\babel\tests\__init__.py:16:1: E302 expected 2 blank lines, found 1

Process finished with exit code 1

7 thoughts on “PyCharm and external lint tools

  1. Beyond that, add the following output filter so PyCharm can parse the Plint output to auto navigate to the file/line/column in your code – “$FILE_PATH$:$LINE$:$COLUMN$”

  2. I haven’t played around with that. I will definitely update/amend the instructions here if/when I find out how. Sad to see you got downvoted to 0 on Stackoverflow. :\

  3. Pingback: Configure PyCharm with to use PyLint on Windows | Claudios Haven

  4. While configuring pylint in pycharm as an External Tool.

    I think we just need to Point our Lint External tool to pylints .exe, usually located in “C:\Python27\Scripts\pylint.exe”.
    Then in Parameter TextBox = $FilePath$.
    And finally in Working Directory =

    That’s all we needed. Now to run just Right Click on File on which you want to Evaluate and click the name you entered in External Tool.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>