From 8f8a7d458f8f46669398591bffd93462d4e439ed Mon Sep 17 00:00:00 2001 From: Tyrel Souza Date: Wed, 29 Apr 2015 22:25:04 -0400 Subject: [PATCH] Fix parsing ignore https://gitlab.com/pycqa/flake8/issues/40 * Adding an ignore option in [flake8] wasn't working because pep8.StyleGuide turned the string sent in into a tuple, which the option parser needs to receive as an iterable that isn't a string. Split on spaces, commas, or semicolons using re.findall in order to get a list of error/warnings to pass to StyleGuide properly. * Add self to contributors --- CONTRIBUTORS.txt | 1 + flake8/engine.py | 2 +- flake8/main.py | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 5acb13e..47f055e 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -22,3 +22,4 @@ Contributors (by order of appearance) : - Austin Morton - Michael McNeil Forbes - Christian Long +- Tyrel Souza \ No newline at end of file diff --git a/flake8/engine.py b/flake8/engine.py index da4f0b6..d05b914 100644 --- a/flake8/engine.py +++ b/flake8/engine.py @@ -118,7 +118,7 @@ def get_style_guide(**kwargs): elif not options.exclude: options.exclude = [] - # Add pattersn in EXTRA_EXCLUDE to the list of excluded patterns + # Add patterns in EXTRA_EXCLUDE to the list of excluded patterns options.exclude.extend(pep8.normalize_paths(EXTRA_EXCLUDE)) for options_hook in options_hooks: diff --git a/flake8/main.py b/flake8/main.py index a11e137..e1d65c5 100644 --- a/flake8/main.py +++ b/flake8/main.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- import os +import re import sys import setuptools @@ -105,6 +106,10 @@ class Flake8Command(setuptools.Command): continue if is_flag(value): value = flag_on(value) + # Check if there's any values that need to be fixed. + if option_name == "include" and isinstance(value, str): + value = re.findall('[^,;\s]+', value) + self.options_dict[option_name] = value def distribution_files(self):