Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run Pylint with PyCharm

I want to configure Pylint as an external tool in my entire project directory for a Python project that I'm working on. I've tried to use the repository as a module with __init__.py and without, and it's not working either way.

I'm having difficulty setting up Pylint to run with PyCharm. I know that I should be running it as an external tool, however the settings confuse me.

The authoritative source on their documentation is broken, so I can't check that up either.

like image 501
Wasif Hyder Avatar asked Jun 30 '16 22:06

Wasif Hyder


People also ask

Which Linter does PyCharm use?

By default, PyCharm uses the TSLint package from the project node_modules folder and the tslint. json configuration file from the folder where the current file is stored. If no tslint. json is found in the current file folder, PyCharm will look for one in its parent folders up to the project root.

How do you test Pylint?

Pylint uses two types of tests: unittests and functional tests. The unittests can be found in the /pylint/test directory and they can be used for testing almost anything Pylint related. The functional tests can be found in the /pylint/test/functional directory.


1 Answers

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

like image 114
lmiguelvargasf Avatar answered Nov 07 '22 10:11

lmiguelvargasf