Skip to content

Instantly share code, notes, and snippets.

@Dmitri-Sintsov
Forked from jsmits/flake8.xml
Last active December 29, 2016 09:09
Show Gist options
  • Save Dmitri-Sintsov/f21c743ae57c3789494e7a6faf212ade to your computer and use it in GitHub Desktop.
Save Dmitri-Sintsov/f21c743ae57c3789494e7a6faf212ade to your computer and use it in GitHub Desktop.
PyCharm Flake8 Configuration XML that uses current virtualenv interpreter.
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.
<toolSet name="Code Checking">
<tool name="Flake8" showInMainMenu="true" showInEditor="true" showInProject="true" showInSearchPopup="true" disabled="false" useConsole="true" showConsoleOnStdOut="false" showConsoleOnStdErr="false" synchronizeAfterRun="true">
<exec>
<option name="COMMAND" value="$PyInterpreterDirectory$/python" />
<option name="PARAMETERS" value="-m flake8 --max-complexity 10 --ignore E501 $FilePath$" />
<option name="WORKING_DIRECTORY" value="$ProjectFileDir$" />
</exec>
<filter>
<option name="NAME" value="Filter 1" />
<option name="DESCRIPTION" />
<option name="REGEXP" value="$FILE_PATH$\:$LINE$\:$COLUMN$\:.*" />
</filter>
<filter>
<option name="NAME" value="Filter 2" />
<option name="DESCRIPTION" />
<option name="REGEXP" value="$FILE_PATH$\:$LINE$\:.*" />
</filter>
</tool>
</toolSet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment