Developers Club geek daily blog

4 years, 6 months ago
In this post I want to tell about interesting enough feature IntelliJ IDEA — Connection of foreign utilities and also to show it on enough common example: I will connect pylint — The analyzer of a code for python projects.

External Tools


In IDEA there is an interesting possibility to use foreign utilities from the interface most IDE. It is possible to add thus anything you like — scripts, analyzers of a code, means of rendering of resources and statistics calculation. And IDEA gives some the abrupt decisions providing comfort of use of utilities which you connect.

Well, we will try to connect any tul?

pylint


pylint — The static analyzer of a code for python. Its functionality is partially crossed with the built in analyzer of a code in IDEA, but it does not cancel its utility in many cases. pylint Checks conformity of a code to standards PEP8 and analyzes a code on potential errors.

Usually pylint Use either through the console, or through plug-ins, but here for IDEA the plug-in is not present.

Connection of foreign tools in IntelliJ IDEA on an example pylint

If to look at a program conclusion, it is possible to notice that each remark concerns a concrete line of a code and it would be desirable to have convenient navigation on files and lines. We will achieve it connection of it tula to IDEA.

We connect pylint to IDEA


To add the new foreign tool it is possible in options Settings -> External Tools

Connection of foreign tools in IntelliJ IDEA on an example pylint

Connection of foreign tools in IntelliJ IDEA on an example pylint

As you have for certain noticed, everything that is necessary that the program worked from interface IDEA, it is necessary practically nothing — to fill out a name, a way to the program, arguments and a working directory. The most interesting here — macro-variables, the powerful tool of interaction of the program, the user and IDE. Look:

Connection of foreign tools in IntelliJ IDEA on an example pylint

It is possible to transfer everything, everything: from ways of directories, files and projects to the allocated fragments, numbers of lines and the text received from a dialogue window.

In our case the absolute way to a file (why absolute, I will explain hardly more low) was necessary for us only.

At last, we will pass to that we initially wished — addressings under remarks pylint. We will pass in section Output Filters:

Connection of foreign tools in IntelliJ IDEA on an example pylint

Here that is necessary for us is adjusted — on regular expression IDEA finds references to lines in a file.

Everything, it is possible to use, cause ours tul it is possible from the menu tools:

Connection of foreign tools in IntelliJ IDEA on an example pylint

Let's look at result of start:

Connection of foreign tools in IntelliJ IDEA on an example pylint

It works! Thus it is possible to introduce many other useful pieces.

It is necessary to tell only about a couple of nuances:

  • At present in IDEA there is a bug, because of which this most pylint Falls on files where there are symbols in UTF-8. You can look/vote for tiket
  • Parser ways of files for some reason understands only absolute ways, ways concerning the project parsit it is impossible. For this reason pylint It is adjusted strange enough — a working folder / It is necessary that in a conclusion there were absolute ways of files.
  • pylint It is started with especial kljuchem --output-format=parseable — It changes a format of a conclusion to more simple for parsing and understood by many applications.

This article is a translation of the original post at habrahabr.ru/post/163227/
If you have any questions regarding the material covered in the article above, please, contact the original author of the post.
If you have any complaints about this article or you want this article to be deleted, please, drop an email here: sysmagazine.com@gmail.com.

We believe that the knowledge, which is available at the most popular Russian IT blog habrahabr.ru, should be accessed by everyone, even though it is poorly translated.
Shared knowledge makes the world better.
Best wishes.

comments powered by Disqus