Skip to content

Instantly share code, notes, and snippets.

@awood
Last active July 23, 2020 16:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save awood/809b0b743d4cb0fd0b5f to your computer and use it in GitHub Desktop.
Save awood/809b0b743d4cb0fd0b5f to your computer and use it in GitHub Desktop.
XML configuration for integrating Flake8 with the Eclipse GrepConsole plugin.

In the Eclipse External Tool Configuration window, I set Flake8 up as follows:

  • Location: /usr/bin/flake8
  • Working Directory: empty
  • Arguments: --format="%(code)s %(text)s [%(path)s:%(row)d:%(col)d]" ${project_loc}

With this Flake8 format, the information about the error is printed first and the location second.

I could not figure out a way to get Eclipse to print a proper relative directory (Even using ${resource_path} printed a leading slash). Nor could I figure out how to get GrepConsole's base directory setting to read from an Eclipse variable. The result with the default Flake 8 format was that in order for everything to work, I had to use absolute path names which crowded all the useful information out of the immediately visible portion of the console. With the custom format, the interesting stuff comes first and the dross is at the end.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<folders xmlns="http://eclipse.musgit.com/grepconsole">
<style background="fdf6e3" bold="true" border="false" foreground="dc322f" id="f272dc1d-f9ec-42d3-814c-e4ec1a1bc469" italic="false" name="Solarized Warn" strikeout="false" underline="false"/>
<style background="fdf6e3" bold="false" border="false" foreground="586e75" id="9986b5c8-344f-4963-bc3b-b1dde3768c06" italic="false" name="Solarized Plain" strikeout="false" underline="false"/>
<folder enabled="true" filter="true" id="903635ba-cd77-41c5-9acd-a137693d1199" notifications="true" statistics="true">
<item enabled="true" expression="^(.*?)\[(.*.py):([0-9]+):([0-9]+)\]" filter="true" id="f41bfe9f-98f7-4008-8b6e-baaba82fd1f3" name="Reversed Flake8 Warning" notifications="true" statistics="true">
<group style="9986b5c8-344f-4963-bc3b-b1dde3768c06">
<fileLink baseDir="" file="{2}" lineNumber="{3}" offset="{4}"/>
</group>
<group style="f272dc1d-f9ec-42d3-814c-e4ec1a1bc469"/>
<group/>
<group/>
<group/>
</item>
</folder>
</folders>
@awood
Copy link
Author

awood commented Sep 4, 2014

GrepConsole can be installed via the Eclipse update site at http://eclipse.schedenig.name

Inspired by http://stackoverflow.com/a/17053592

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