Repository: asottile/yesqa

Issue:
flake8 3.7 allows `# noqa:C123` without a space
make yesqa understand this too!

Discussion:

Patch:
diff --git a/setup.py b/setup.py
index a2b2475..944c90c 100644
--- a/setup.py
+++ b/setup.py
@@ -17,7 +17,7 @@ setup(
         'Programming Language :: Python :: Implementation :: CPython',
         'Programming Language :: Python :: Implementation :: PyPy',
     ],
-    install_requires=['flake8', 'tokenize-rt>=2.1'],
+    install_requires=['flake8>=3.7', 'tokenize-rt>=2.1'],
     py_modules=['yesqa'],
     entry_points={'console_scripts': ['yesqa = yesqa:main']},
 )
diff --git a/yesqa.py b/yesqa.py
index f74257e..5beb9c7 100644
--- a/yesqa.py
+++ b/yesqa.py
@@ -15,7 +15,7 @@ import tokenize_rt
 NOQA_FILE_RE = re.compile(r'^# flake8[:=]\s*noqa', re.I)
 _code = '[a-z][0-9]+'
 _sep = r'[,\s]+'
-NOQA_RE = re.compile('# noqa(: {c}({s}{c})*)?'.format(c=_code, s=_sep), re.I)
+NOQA_RE = re.compile('# noqa(: ?{c}({s}{c})*)?'.format(c=_code, s=_sep), re.I)
 SEP_RE = re.compile(_sep)
 
 
@@ -75,7 +75,7 @@ def _rewrite_noqa_comment(tokens, i, flake8_results):
             src = '# {}'.format(src)
         tokens[i] = token._replace(src=src)
     elif match.group().lower() != '# noqa':
-        codes = set(SEP_RE.split(match.group(1)[2:]))
+        codes = set(SEP_RE.split(match.group(1)[1:]))
         expected_codes = codes & lints
         if expected_codes != codes:
             comment = '# noqa: {}'.format(','.join(sorted(expected_codes)))


Test patch:
diff --git a/tests/yesqa_test.py b/tests/yesqa_test.py
index 877509c..25fd493 100644
--- a/tests/yesqa_test.py
+++ b/tests/yesqa_test.py
@@ -36,6 +36,7 @@ def test_non_utf8_bytes(tmpdir, capsys):
         'import os  # noqa\n',
         'import os  # NOQA\n',
         'import os  # noqa: F401\n',
+        'import os  # noqa:F401\n',
         'import os  # noqa: F401 isort:skip\n',
         'import os  # isort:skip # noqa\n',
         'import os  # isort:skip # noqa: F401\n',
@@ -54,6 +55,7 @@ def test_ok(assert_rewrite, src):
         # line comments
         ('x = 1  # noqa\n', 'x = 1\n'),
         ('import os  # noqa: F401,X999\n', 'import os  # noqa: F401\n'),
+        ('import os  # noqa:F401,X999\n', 'import os  # noqa: F401\n'),
         ('# foo # noqa\nx = 1\n', '# foo\nx = 1\n'),
         ('# noqa # foo\nx = 1\n', '# foo\nx = 1\n'),
         (