Skip to content

Commit

Permalink
Error when flake8 v2 found
Browse files Browse the repository at this point in the history
  • Loading branch information
dhood committed Jan 4, 2017
1 parent 256264a commit 81e6f10
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions ament_flake8/ament_flake8/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,21 @@
from xml.sax.saxutils import escape
from xml.sax.saxutils import quoteattr

from flake8.main import application as flake8_app
from flake8.api.legacy import StyleGuide
import flake8
from distutils.version import LooseVersion


def main(argv=sys.argv[1:]):
if LooseVersion(flake8.__version__) < '3.0':
print(
"Found Flake8 version '%s'; " % flake8.__version__ +
"only version >= 3.0 is supported.", file=sys.stderr)
return 1

global flake8_app, StyleGuide
from flake8.main import application as flake8_app
from flake8.api.legacy import StyleGuide

config_file = os.path.join(
os.path.dirname(__file__), 'configuration', 'ament_flake8.ini')

Expand Down Expand Up @@ -66,7 +76,7 @@ def main(argv=sys.argv[1:]):
start_time = time.time()

if not os.path.exists(args.config_file):
print("Could not config file '%s'" % args.config_file, file=sys.stderr)
print("Could not find config file '%s'" % args.config_file, file=sys.stderr)
return 1

report = generate_flake8_report(
Expand Down

0 comments on commit 81e6f10

Please sign in to comment.