The following is based on the answers to this StackOverflow question: Descriptive flake8 errors in PyCharm

At the time of writing (2019-05) PyCharm doesn’t have support for Flake8. There is a way to use it as an external tool.

First, make sure that flake8 is installed in the current environment. For a Windows venv project the path will be:

Then, go to the PyCharm’s File menu and browse to File > Settings. In the “Settings” window, find Tools > External Tools and add a new external tool configuration.

For the program, use a macro that specifies the full file system path to the project directory:

The arguments line is:

The --format key will present the output in a descriptive way and provide a link to the error description located at the Flake8Rules project.

To test for McCabe complexity add the --max-complexity parameter. Its value should be around 10-12:

### Demo

Create a file app.py with the following content:

In the Project file list, right-click the file and select External Tools > flake8. You should see the output like this: