In this post I want to tell you about a rather interesting feature of
IntelliJ IDEA
- connecting third-party utilities, and also to demonstrate it with a fairly typical example: I will connect
pylint
- a code analyzer for python projects.
External tools
In IDEA there is an interesting opportunity to use third-party utilities from the interface of the IDE itself. You can add anything in this way - scripts, code analyzers, means for rendering resources and calculating statistics. And IDEA provides some cool solutions that provide the comfort of using the utilities that you plug in.
Well, let's try to connect some tul?
')
pylint
pylint
is a static code analyzer for
python
. Its functionality overlaps with the built-in code analyzer in IDEA, but this does not negate its usefulness in many cases.
pylint
checks the compliance of the code with the
PEP8 standards and analyzes the code for potential errors.
Usually
pylint
used either through the console or via plug-ins, but for IDEA there is no plug-in.

If you look at the output of the program, you will notice that each comment relates to a specific line of code and I would like to have easy navigation through files and lines. This is what we will be trying to achieve by connecting this tool to IDEA.
We connect pylint to IDEA
You can add a new third-party tool in
Settings -> External Tools


As you probably noticed, all that is needed for the program to work from the IDEA interface, you need nothing at all - specify the name, the path to the program, the arguments and the working directory. The most interesting thing here is macro variables, a powerful tool for interaction between a program, a user, and an IDE. Take a look:

You can transfer anything you like: from paths of directories, files and projects to selected fragments, line numbers and text received from the dialog box.
In our case, we needed only the absolute path to the file (why absolute, I will explain a little below).
Finally, we move on to what we initially wanted - addressing
pylint
comments. Go to the
Output Filters
section:

This is where we set up what we need - IDEA finds references to lines in a file using a regular expression.
Everything, you can use, you can call our
tools
from the
tools
menu:

Let's look at the result of the launch:

It works! This way you can embed a lot of other useful pieces.
It remains only to say about a couple of nuances:
- At the moment there is a bug in IDEA, because of which this very
pylint
falls on files where there are characters in UTF-8. You can watch / vote for the ticket - For some reason, the parser of file paths understands only absolute paths, a parsing path for a project is impossible. That is why
pylint
configured rather strangely - the working folder /
needed for the output to have absolute file paths. pylint
runs with a special key --output-format=parseable
- it changes the output format to easier parsing and is understood by many applications.