Skip to content

Instantly share code, notes, and snippets.

@tossmilestone
Created March 30, 2018 06:55
Show Gist options
  • Save tossmilestone/23139d870841a3d5cba2aea28da1a895 to your computer and use it in GitHub Desktop.
Save tossmilestone/23139d870841a3d5cba2aea28da1a895 to your computer and use it in GitHub Desktop.
Flake8 integrated with PyCharm
How to manually setup flake8 as PyCharm external tool
File / Settings / Tools / External Tools / Add
Name: Flake8
Program: $PyInterpreterDirectory$/python
Parameters: -m flake8 --max-complexity 10 --ignore E501 $FilePath$
Working directory: $ProjectFileDir$
Output Filters / Add
Name: Filter 1
Regular expression to match output:
$FILE_PATH$\:$LINE$\:$COLUMN$\:.*
Output Filters / Add
Name: Filter 2
Regular expression to match output:
$FILE_PATH$\:$LINE$\:.*
To check source with flake8:
Tools / External Tools / Flake8
Can be used with single files as well as with directories, recursively.
@ulan-yisaev
Copy link

Thank's a lot, really helpful info! 👍

@MeboxForever
Copy link

thanks for helps!!

@haim0n
Copy link

haim0n commented Nov 11, 2021

Created a small repo for pycharm external tools (currently flake8 and black supported ) for applying to a code selection from pycharm.
Maybe this will be somewhat helpful to anyone: https://github.com/haim0n/pycharm_ext_tools

@banagale
Copy link

Thank you, @haim0n!

@lucasslima
Copy link

Thank you, worked like a charm!

@haim0n
Copy link

haim0n commented Jul 31, 2023

Cheers , glad to help :)

Just bear in mind that flake8 deprecated the support for --diff option in its next versions: https://flake8.pycqa.org/en/latest/release-notes/5.0.0.html#deprecations

@JonZavialov
Copy link

This was useful but it should be noted that it only logs the Flake8 output in the terminal. This library worked well for me to integrate the output into Pycharm's Pylint plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment