Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E101: checker misreports issue with triple-quote literal after # noqa: E101 is specified on the "right block" #886

Closed
ngie-eign opened this issue Sep 24, 2019 · 6 comments

Comments

@ngie-eign
Copy link

My group wrote a C code generator in python once upon a time, which has some embedded C in in. Because the style used by the group mismatches with PEP8 for the content, flake8 warns about some stylistic issues with the embedded template code.

Applying #noqa: E101,E122 works around the issue, except it still misreports one of the lines:

$ flake8 --version
3.7.7 (mccabe: 0.6.1, pycodestyle: 2.5.0, pyflakes: 2.1.1) CPython 3.7.4 on Linux
$ flake8 ~/flake8_bug.py 
/home/ecooper/flake8_bug.py:20:1: E101 indentation contains mixed spaces and tabs
$ hexdump -C ~/flake8_bug.py 
00000000  23 21 2f 75 73 72 2f 62  69 6e 2f 65 6e 76 20 70  |#!/usr/bin/env p|
00000010  79 74 68 6f 6e 0a 0a 66  72 6f 6d 20 5f 5f 66 75  |ython..from __fu|
00000020  74 75 72 65 5f 5f 20 69  6d 70 6f 72 74 20 70 72  |ture__ import pr|
00000030  69 6e 74 5f 66 75 6e 63  74 69 6f 6e 0a 0a 0a 64  |int_function...d|
00000040  65 66 20 68 65 6c 6c 6f  5f 77 6f 72 6c 64 28 29  |ef hello_world()|
00000050  3a 0a 20 20 20 20 73 20  3d 20 5c 0a 22 22 22 2f  |:.    s = \."""/|
00000060  2a 0a 2a 20 59 65 20 6f  6c 64 65 2c 20 68 65 6c  |*.* Ye olde, hel|
00000070  6c 6f 20 77 6f 72 6c 64  20 70 72 6f 67 72 61 6d  |lo world program|
00000080  20 28 69 6e 20 43 21 29  21 0a 2a 2f 0a 0a 23 69  | (in C!)!.*/..#i|
00000090  6e 63 6c 75 64 65 20 3c  73 74 64 69 6f 2e 68 3e  |nclude <stdio.h>|
000000a0  0a 0a 69 6e 74 0a 6d 61  69 6e 28 76 6f 69 64 29  |..int.main(void)|
000000b0  20 7b 0a 09 70 72 69 6e  74 66 28 22 68 65 6c 6c  | {..printf("hell|
000000c0  6f 20 77 6f 72 6c 64 21  5c 6e 22 29 3b 0a 09 72  |o world!\n");..r|
000000d0  65 74 75 72 6e 20 28 30  29 3b 0a 7d 0a 22 22 22  |eturn (0);.}."""|
000000e0  20 20 23 20 6e 6f 71 61  3a 20 45 31 30 31 2c 45  |  # noqa: E101,E|
000000f0  31 32 32 2c 57 31 39 31  0a 20 20 20 20 70 72 69  |122,W191.    pri|
00000100  6e 74 28 73 2c 20 65 6e  64 3d 22 22 29 0a 0a 0a  |nt(s, end="")...|
00000110  69 66 20 5f 5f 6e 61 6d  65 5f 5f 20 3d 3d 20 22  |if __name__ == "|
00000120  5f 5f 6d 61 69 6e 5f 5f  22 3a 0a 20 20 20 20 68  |__main__":.    h|
00000130  65 6c 6c 6f 5f 77 6f 72  6c 64 28 29 0a           |ello_world().|
0000013d

The issue reported on line 20 is bogus (it's a properly formatted line, which aligns with the formatting from line 7). I suspect what happened with the triple-quote string literal is that it reset indent_char somehow, which is wrong.

Sample file attached.

pycodestyle_bug.py.txt

@ngie-eign ngie-eign changed the title E101 is misdetects and misreports line after # noqa: E101 is specified on the "right block" E101 is misdetects and misreports issue with triple-quote literal after # noqa: E101 is specified on the "right block" Sep 24, 2019
@asottile
Copy link
Member

this appears to be a bug with flake8 and not with pycodestyle -- let's continue this there: https://gitlab.com/pycqa/flake8

$ python3 -m pycodestyle t.py
$ echo $?
0
$ flake8 t.py
t.py:20:1: E101 indentation contains mixed spaces and tabs

@asottile
Copy link
Member

actually 🤔

if you remove the noqa it resurfaces, making this less clear cut on what the correct behaviour is here:

$ python3 -m pycodestyle t.py
t.py:8:1: E122 continuation line missing indentation or outdented
t.py:16:1: E101 indentation contains mixed spaces and tabs
t.py:16:1: W191 indentation contains tabs
t.py:17:1: W191 indentation contains tabs
t.py:20:1: E101 indentation contains mixed spaces and tabs

@asottile
Copy link
Member

to me this patch to pycodestyle makes the most sense:

$ git diff
diff --git a/pycodestyle.py b/pycodestyle.py
index 4ade087..17ed575 100755
--- a/pycodestyle.py
+++ b/pycodestyle.py
@@ -1980,8 +1980,6 @@ class Checker(object):
             if result is not None:
                 (offset, text) = result
                 self.report_error(self.line_number, offset, text, check)
-                if text[:4] == 'E101':
-                    self.indent_char = line[0]
 
     def build_tokens_line(self):
         """Build a logical line from tokens."""

plus this patch to flake8:

$ git diff | cat
diff --git a/src/flake8/checker.py b/src/flake8/checker.py
index 2df7e42..9e1c7c8 100644
--- a/src/flake8/checker.py
+++ b/src/flake8/checker.py
@@ -565,9 +565,6 @@ class FileChecker(object):
                         text=text,
                         line=(override_error_line or physical_line),
                     )
-                    self.processor.check_physical_error(
-                        error_code, physical_line
-                    )
 
     def process_tokens(self):
         """Process tokens and trigger checks.
diff --git a/src/flake8/processor.py b/src/flake8/processor.py
index dad4d7b..83e2afc 100644
--- a/src/flake8/processor.py
+++ b/src/flake8/processor.py
@@ -261,12 +261,6 @@ class FileProcessor(object):
                     )
         return arguments
 
-    def check_physical_error(self, error_code, line):
-        # type: (str, str) -> None
-        """Update attributes based on error code and line."""
-        if error_code == "E101":
-            self.indent_char = line[0]
-
     def generate_tokens(self):  # type: () -> Generator[_Token, None, None]
         """Tokenize the file and yield the tokens.
 
diff --git a/tests/integration/test_main.py b/tests/integration/test_main.py
index 72e9621..891bafb 100644
--- a/tests/integration/test_main.py
+++ b/tests/integration/test_main.py
@@ -51,6 +51,25 @@ index d64ac39..7d943de 100644
     assert err == ''
 
 
+def test_E101_indent_char_resetting(tmpdir, capsys):
+    """Ensure that E101 with an existing indent_char does not reset it."""
+    t_py_contents = """\
+if True:
+    print('space indented')
+
+s = '''\
+\ttab indented
+'''  # noqa: E101
+
+if True:
+    print('space indented')
+"""
+
+    with tmpdir.as_cwd():
+        tmpdir.join('t.py').write(t_py_contents)
+        _call_main(['t.py'])
+
+
 def test_statistics_option(tmpdir, capsys):
     """Ensure that `flake8 --statistics` works."""
     with tmpdir.as_cwd():
diff --git a/tests/unit/test_file_processor.py b/tests/unit/test_file_processor.py
index c3ae021..afae77d 100644
--- a/tests/unit/test_file_processor.py
+++ b/tests/unit/test_file_processor.py
@@ -146,24 +146,6 @@ def test_next_line(default_options):
         assert file_processor.line_number == i
 
 
-@pytest.mark.parametrize('error_code, line, expected_indent_char', [
-    ('E101', '\t\ta = 1', '\t'),
-    ('E101', '    a = 1', ' '),
-    ('W101', 'frobulate()', None),
-    ('F821', 'class FizBuz:', None),
-])
-def test_check_physical_error(
-        error_code, line, expected_indent_char, default_options,
-):
-    """Verify we update the indet char for the appropriate error code."""
-    file_processor = processor.FileProcessor('-', default_options, lines=[
-        'Line 1',
-    ])
-
-    file_processor.check_physical_error(error_code, line)
-    assert file_processor.indent_char == expected_indent_char
-
-
 @pytest.mark.parametrize('params, args, expected_kwargs', [
     ({'blank_before': True, 'blank_lines': True},
         None,

@asottile
Copy link
Member

here's flake8's part of that: https://gitlab.com/pycqa/flake8/merge_requests/357

@ngie-eign ngie-eign changed the title E101 is misdetects and misreports issue with triple-quote literal after # noqa: E101 is specified on the "right block" E101 checker misreports issue with triple-quote literal after # noqa: E101 is specified on the "right block" Sep 24, 2019
bors bot added a commit to duckinator/emanate that referenced this issue May 13, 2020
116: Update flake8 to 3.8.1 r=duckinator a=pyup-bot


This PR updates [flake8](https://pypi.org/project/flake8) from **3.7.9** to **3.8.1**.



<details>
  <summary>Changelog</summary>
  
  
   ### 3.8.1
   ```
   -------------------

You can view the `3.8.1 milestone`_ on GitLab for more details.

Bugs Fixed
~~~~~~~~~~

- Fix ``--output-file`` (regression in 3.8.0) (See also `GitLab!427`_,
  `GitLab637`_)


.. all links
.. _3.8.1 milestone:
    https://gitlab.com/pycqa/flake8/-/milestones/34

.. issue links
.. _GitLab637:
    https://gitlab.com/pycqa/flake8/issues/637

.. merge request links
.. _GitLab!427:
    https://gitlab.com/pycqa/flake8/merge_requests/427
   ```
   
  
  
   ### 3.8.0
   ```
   -------------------

You can view the `3.8.0 milestone`_ on GitLab for more details.

Bugs Fixed
~~~~~~~~~~

- Fix logical checks which report positions out of bounds (See also
  `GitLab!422`_, `GitLab635`_)

- Fix ``--exclude=.*`` accidentally matching ``.`` and ``..`` (See also
  `GitLab!424`_, `GitLab632`_)

Deprecations
~~~~~~~~~~~~

- Add deprecation message for vcs hooks (See also `GitLab!420`_,
  `GitLab568`_)
   ```
   
  
  
   ### 3.8.0a2
   ```
   ---------------------

You can view the `3.8.0 milestone`_ on GitLab for more details.

Bugs Fixed
~~~~~~~~~~

- Fix ``type=&quot;str&quot;`` optparse options (See also `GitLab!419`_)
   ```
   
  
  
   ### 3.8.0a1
   ```
   ---------------------

You can view the `3.8.0 milestone`_ on GitLab for more details.

New Dependency Information
~~~~~~~~~~~~~~~~~~~~~~~~~~

- Remove dependency on ``entrypoints`` and add dependency on
  ``importlib-metadata`` (only for ``python&lt;3.8``) (See also `GitLab!388`_,
  `GitLab569`_)

- Pyflakes has been updated to &gt;= 2.2.0, &lt; 2.3.0 (See also `GitLab!417`_)

- pycodestyle has been updated to &gt;= 2.6.0a1, &lt; 2.7.0 (See also `GitLab!418`_)

Features
~~~~~~~~

- Add ``--extend-exclude`` option to add to ``--exclude`` without overwriting
  (See also `GitLab!315`_, `GitLab535`_)

- Move argument parsing from ``optparse`` to ``argparse`` (See also
  `GitLab!341`_

- Group plugin options in ``--help`` (See also `GitLab!342`_, `GitLab565`_)

- Remove parsing of ``verbose`` from configuration files as it was not
  consistently applied (See also `GitLab!360`_, `GitLab439`_)

- Remove parsing of ``output_file`` from configuration files as it was not
  consistently applied (See also `GitLab!361`_)

- Resolve configuration files relative to ``cwd`` instead of common prefix of
  passed filenames.  You may need to change ``flake8 subproject`` to
  ``cd subproject &amp;&amp; flake8 .`` (See also `GitLab!363`_)

- Officially support python3.8 (See also `GitLab!377`_)

- ``--disable-noqa`` now also disables `` flake8: noqa`` (See also
  `GitLab!380`_, `GitLab590`_)

- Ensure that a missing file produces a ``E902`` error (See also `GitLab!404`_,
  `GitLab600`_)

- `` noqa`` comments now apply to all of the lines in an explicit ``\``
  continuation or in a line continued by a multi-line string (See also
  `GitLab!413`_, `GitLab375`_)

Bugs Fixed
~~~~~~~~~~

- Fix ``--exclude=./t.py`` to only match ``t.py`` at the top level (See also
  `GitLab!311`_, `GitLab382`_)

- Fix ``--show-source`` when a file is indented with tabs (See also
  `GitLab!339`_, `GitLab563`_)

- Fix crash when ``--max-line-length`` is given a non-integer (See also
  `GitLab!341`_, `GitLab541`_)

- Prevent flip-flopping of ``indent_char`` causing extra ``E101`` errors (See
  also `GitLab!357`_, `pycodestyle886`_)

- Only enable multiprocessing when the method is ``fork`` fixing issues
  on macos with python3.8+ (See also `GitLab!366`_, `GitLab587`_) (note: this
  fix also landed in 3.7.9)

- ``noqa`` is now only handled by flake8 fixing specific-noqa.  Plugins
  requesting this parameter will always receive ``False`` (See also
  `GitLab!331`_, `GitLab552`_)

- Fix duplicate loading of plugins when invoked via ``python -m flake8`` (See
  also `GitLab!388`_)

- Fix early exit when ``--exit-zero`` and ``--diff`` are provided and the diff
  is empty (See also `GitLab!391`_)

- Consistently split lines when ``\f`` is present when reading from stdin (See
  also `GitLab!406`_, `GitLab270`_)

Deprecations
~~~~~~~~~~~~

- ``python setup.py flake8`` (setuptools integration) is now deprecated and
  will be removed in a future version (See also `GitLab!330`_, `GitLab544`_)

- ``type=&#39;string&#39;`` (optparse) types are deprecated, use
  ``type=callable`` (argparse) instead.  Support for ``type=&#39;string&#39;`` will
  be removed in a future version (See also `GitLab!341`_)

- ``%default`` in plugin option help text is deprecated, use ``%(default)s``
  instead.  Support for ``%default`` will be removed in a future version (See
  also `GitLab!341`_)

- optparse-style ``action=&#39;callback&#39;`` setting for options is deprecated, use
  argparse action classes instead.  This will be removed in a future version
  (See also `GitLab!341`_)


.. all links
.. _3.8.0 milestone:
    https://gitlab.com/pycqa/flake8/-/milestones/32

.. merge request links
.. _GitLab270:
   https://gitlab.com/pycqa/flake8/-/issues/270
.. _GitLab375:
   https://gitlab.com/pycqa/flake8/-/issues/375
.. _GitLab382:
   https://gitlab.com/pycqa/flake8/-/issues/382
.. _GitLab439:
   https://gitlab.com/pycqa/flake8/-/issues/439
.. _GitLab535:
   https://gitlab.com/pycqa/flake8/-/issues/535
.. _GitLab541:
   https://gitlab.com/pycqa/flake8/-/issues/541
.. _GitLab544:
   https://gitlab.com/pycqa/flake8/-/issues/544
.. _GitLab552:
   https://gitlab.com/pycqa/flake8/-/issues/552
.. _GitLab563:
   https://gitlab.com/pycqa/flake8/-/issues/563
.. _GitLab565:
   https://gitlab.com/pycqa/flake8/-/issues/565
.. _GitLab568:
   https://gitlab.com/pycqa/flake8/-/issues/568
.. _GitLab569:
   https://gitlab.com/pycqa/flake8/-/issues/569
.. _GitLab587:
   https://gitlab.com/pycqa/flake8/-/issues/587
.. _GitLab590:
   https://gitlab.com/pycqa/flake8/-/issues/590
.. _GitLab600:
   https://gitlab.com/pycqa/flake8/-/issues/600
.. _GitLab632:
   https://gitlab.com/pycqa/flake8/-/issues/632
.. _GitLab635:
   https://gitlab.com/pycqa/flake8/-/issues/635
.. _pycodestyle886:
   PyCQA/pycodestyle#886

.. issue links
.. _GitLab!311:
   https://gitlab.com/pycqa/flake8/-/merge_requests/311
.. _GitLab!315:
   https://gitlab.com/pycqa/flake8/-/merge_requests/315
.. _GitLab!330:
   https://gitlab.com/pycqa/flake8/-/merge_requests/330
.. _GitLab!331:
   https://gitlab.com/pycqa/flake8/-/merge_requests/331
.. _GitLab!339:
   https://gitlab.com/pycqa/flake8/-/merge_requests/339
.. _GitLab!341:
   https://gitlab.com/pycqa/flake8/-/merge_requests/341
.. _GitLab!342:
   https://gitlab.com/pycqa/flake8/-/merge_requests/342
.. _GitLab!357:
   https://gitlab.com/pycqa/flake8/-/merge_requests/357
.. _GitLab!360:
   https://gitlab.com/pycqa/flake8/-/merge_requests/360
.. _GitLab!361:
   https://gitlab.com/pycqa/flake8/-/merge_requests/361
.. _GitLab!363:
   https://gitlab.com/pycqa/flake8/-/merge_requests/363
.. _GitLab!366:
   https://gitlab.com/pycqa/flake8/-/merge_requests/366
.. _GitLab!377:
   https://gitlab.com/pycqa/flake8/-/merge_requests/377
.. _GitLab!380:
   https://gitlab.com/pycqa/flake8/-/merge_requests/380
.. _GitLab!388:
   https://gitlab.com/pycqa/flake8/-/merge_requests/388
.. _GitLab!391:
   https://gitlab.com/pycqa/flake8/-/merge_requests/391
.. _GitLab!404:
   https://gitlab.com/pycqa/flake8/-/merge_requests/404
.. _GitLab!406:
   https://gitlab.com/pycqa/flake8/-/merge_requests/406
.. _GitLab!413:
   https://gitlab.com/pycqa/flake8/-/merge_requests/413
.. _GitLab!417:
   https://gitlab.com/pycqa/flake8/-/merge_requests/417
.. _GitLab!418:
   https://gitlab.com/pycqa/flake8/-/merge_requests/418
.. _GitLab!419:
   https://gitlab.com/pycqa/flake8/-/merge_requests/419
.. _GitLab!420:
   https://gitlab.com/pycqa/flake8/-/merge_requests/420
.. _GitLab!422:
   https://gitlab.com/pycqa/flake8/-/merge_requests/422
.. _GitLab!424:
   https://gitlab.com/pycqa/flake8/-/merge_requests/424
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/flake8
  - Changelog: https://pyup.io/changelogs/flake8/
  - Repo: https://gitlab.com/pycqa/flake8
</details>



Co-authored-by: pyup-bot <github-bot@pyup.io>
bors bot added a commit to duckinator/emanate that referenced this issue May 14, 2020
116: Update flake8 to 3.8.1 r=duckinator a=pyup-bot


This PR updates [flake8](https://pypi.org/project/flake8) from **3.7.9** to **3.8.1**.



<details>
  <summary>Changelog</summary>
  
  
   ### 3.8.1
   ```
   -------------------

You can view the `3.8.1 milestone`_ on GitLab for more details.

Bugs Fixed
~~~~~~~~~~

- Fix ``--output-file`` (regression in 3.8.0) (See also `GitLab!427`_,
  `GitLab637`_)


.. all links
.. _3.8.1 milestone:
    https://gitlab.com/pycqa/flake8/-/milestones/34

.. issue links
.. _GitLab637:
    https://gitlab.com/pycqa/flake8/issues/637

.. merge request links
.. _GitLab!427:
    https://gitlab.com/pycqa/flake8/merge_requests/427
   ```
   
  
  
   ### 3.8.0
   ```
   -------------------

You can view the `3.8.0 milestone`_ on GitLab for more details.

Bugs Fixed
~~~~~~~~~~

- Fix logical checks which report positions out of bounds (See also
  `GitLab!422`_, `GitLab635`_)

- Fix ``--exclude=.*`` accidentally matching ``.`` and ``..`` (See also
  `GitLab!424`_, `GitLab632`_)

Deprecations
~~~~~~~~~~~~

- Add deprecation message for vcs hooks (See also `GitLab!420`_,
  `GitLab568`_)
   ```
   
  
  
   ### 3.8.0a2
   ```
   ---------------------

You can view the `3.8.0 milestone`_ on GitLab for more details.

Bugs Fixed
~~~~~~~~~~

- Fix ``type=&quot;str&quot;`` optparse options (See also `GitLab!419`_)
   ```
   
  
  
   ### 3.8.0a1
   ```
   ---------------------

You can view the `3.8.0 milestone`_ on GitLab for more details.

New Dependency Information
~~~~~~~~~~~~~~~~~~~~~~~~~~

- Remove dependency on ``entrypoints`` and add dependency on
  ``importlib-metadata`` (only for ``python&lt;3.8``) (See also `GitLab!388`_,
  `GitLab569`_)

- Pyflakes has been updated to &gt;= 2.2.0, &lt; 2.3.0 (See also `GitLab!417`_)

- pycodestyle has been updated to &gt;= 2.6.0a1, &lt; 2.7.0 (See also `GitLab!418`_)

Features
~~~~~~~~

- Add ``--extend-exclude`` option to add to ``--exclude`` without overwriting
  (See also `GitLab!315`_, `GitLab535`_)

- Move argument parsing from ``optparse`` to ``argparse`` (See also
  `GitLab!341`_

- Group plugin options in ``--help`` (See also `GitLab!342`_, `GitLab565`_)

- Remove parsing of ``verbose`` from configuration files as it was not
  consistently applied (See also `GitLab!360`_, `GitLab439`_)

- Remove parsing of ``output_file`` from configuration files as it was not
  consistently applied (See also `GitLab!361`_)

- Resolve configuration files relative to ``cwd`` instead of common prefix of
  passed filenames.  You may need to change ``flake8 subproject`` to
  ``cd subproject &amp;&amp; flake8 .`` (See also `GitLab!363`_)

- Officially support python3.8 (See also `GitLab!377`_)

- ``--disable-noqa`` now also disables `` flake8: noqa`` (See also
  `GitLab!380`_, `GitLab590`_)

- Ensure that a missing file produces a ``E902`` error (See also `GitLab!404`_,
  `GitLab600`_)

- `` noqa`` comments now apply to all of the lines in an explicit ``\``
  continuation or in a line continued by a multi-line string (See also
  `GitLab!413`_, `GitLab375`_)

Bugs Fixed
~~~~~~~~~~

- Fix ``--exclude=./t.py`` to only match ``t.py`` at the top level (See also
  `GitLab!311`_, `GitLab382`_)

- Fix ``--show-source`` when a file is indented with tabs (See also
  `GitLab!339`_, `GitLab563`_)

- Fix crash when ``--max-line-length`` is given a non-integer (See also
  `GitLab!341`_, `GitLab541`_)

- Prevent flip-flopping of ``indent_char`` causing extra ``E101`` errors (See
  also `GitLab!357`_, `pycodestyle886`_)

- Only enable multiprocessing when the method is ``fork`` fixing issues
  on macos with python3.8+ (See also `GitLab!366`_, `GitLab587`_) (note: this
  fix also landed in 3.7.9)

- ``noqa`` is now only handled by flake8 fixing specific-noqa.  Plugins
  requesting this parameter will always receive ``False`` (See also
  `GitLab!331`_, `GitLab552`_)

- Fix duplicate loading of plugins when invoked via ``python -m flake8`` (See
  also `GitLab!388`_)

- Fix early exit when ``--exit-zero`` and ``--diff`` are provided and the diff
  is empty (See also `GitLab!391`_)

- Consistently split lines when ``\f`` is present when reading from stdin (See
  also `GitLab!406`_, `GitLab270`_)

Deprecations
~~~~~~~~~~~~

- ``python setup.py flake8`` (setuptools integration) is now deprecated and
  will be removed in a future version (See also `GitLab!330`_, `GitLab544`_)

- ``type=&#39;string&#39;`` (optparse) types are deprecated, use
  ``type=callable`` (argparse) instead.  Support for ``type=&#39;string&#39;`` will
  be removed in a future version (See also `GitLab!341`_)

- ``%default`` in plugin option help text is deprecated, use ``%(default)s``
  instead.  Support for ``%default`` will be removed in a future version (See
  also `GitLab!341`_)

- optparse-style ``action=&#39;callback&#39;`` setting for options is deprecated, use
  argparse action classes instead.  This will be removed in a future version
  (See also `GitLab!341`_)


.. all links
.. _3.8.0 milestone:
    https://gitlab.com/pycqa/flake8/-/milestones/32

.. merge request links
.. _GitLab270:
   https://gitlab.com/pycqa/flake8/-/issues/270
.. _GitLab375:
   https://gitlab.com/pycqa/flake8/-/issues/375
.. _GitLab382:
   https://gitlab.com/pycqa/flake8/-/issues/382
.. _GitLab439:
   https://gitlab.com/pycqa/flake8/-/issues/439
.. _GitLab535:
   https://gitlab.com/pycqa/flake8/-/issues/535
.. _GitLab541:
   https://gitlab.com/pycqa/flake8/-/issues/541
.. _GitLab544:
   https://gitlab.com/pycqa/flake8/-/issues/544
.. _GitLab552:
   https://gitlab.com/pycqa/flake8/-/issues/552
.. _GitLab563:
   https://gitlab.com/pycqa/flake8/-/issues/563
.. _GitLab565:
   https://gitlab.com/pycqa/flake8/-/issues/565
.. _GitLab568:
   https://gitlab.com/pycqa/flake8/-/issues/568
.. _GitLab569:
   https://gitlab.com/pycqa/flake8/-/issues/569
.. _GitLab587:
   https://gitlab.com/pycqa/flake8/-/issues/587
.. _GitLab590:
   https://gitlab.com/pycqa/flake8/-/issues/590
.. _GitLab600:
   https://gitlab.com/pycqa/flake8/-/issues/600
.. _GitLab632:
   https://gitlab.com/pycqa/flake8/-/issues/632
.. _GitLab635:
   https://gitlab.com/pycqa/flake8/-/issues/635
.. _pycodestyle886:
   PyCQA/pycodestyle#886

.. issue links
.. _GitLab!311:
   https://gitlab.com/pycqa/flake8/-/merge_requests/311
.. _GitLab!315:
   https://gitlab.com/pycqa/flake8/-/merge_requests/315
.. _GitLab!330:
   https://gitlab.com/pycqa/flake8/-/merge_requests/330
.. _GitLab!331:
   https://gitlab.com/pycqa/flake8/-/merge_requests/331
.. _GitLab!339:
   https://gitlab.com/pycqa/flake8/-/merge_requests/339
.. _GitLab!341:
   https://gitlab.com/pycqa/flake8/-/merge_requests/341
.. _GitLab!342:
   https://gitlab.com/pycqa/flake8/-/merge_requests/342
.. _GitLab!357:
   https://gitlab.com/pycqa/flake8/-/merge_requests/357
.. _GitLab!360:
   https://gitlab.com/pycqa/flake8/-/merge_requests/360
.. _GitLab!361:
   https://gitlab.com/pycqa/flake8/-/merge_requests/361
.. _GitLab!363:
   https://gitlab.com/pycqa/flake8/-/merge_requests/363
.. _GitLab!366:
   https://gitlab.com/pycqa/flake8/-/merge_requests/366
.. _GitLab!377:
   https://gitlab.com/pycqa/flake8/-/merge_requests/377
.. _GitLab!380:
   https://gitlab.com/pycqa/flake8/-/merge_requests/380
.. _GitLab!388:
   https://gitlab.com/pycqa/flake8/-/merge_requests/388
.. _GitLab!391:
   https://gitlab.com/pycqa/flake8/-/merge_requests/391
.. _GitLab!404:
   https://gitlab.com/pycqa/flake8/-/merge_requests/404
.. _GitLab!406:
   https://gitlab.com/pycqa/flake8/-/merge_requests/406
.. _GitLab!413:
   https://gitlab.com/pycqa/flake8/-/merge_requests/413
.. _GitLab!417:
   https://gitlab.com/pycqa/flake8/-/merge_requests/417
.. _GitLab!418:
   https://gitlab.com/pycqa/flake8/-/merge_requests/418
.. _GitLab!419:
   https://gitlab.com/pycqa/flake8/-/merge_requests/419
.. _GitLab!420:
   https://gitlab.com/pycqa/flake8/-/merge_requests/420
.. _GitLab!422:
   https://gitlab.com/pycqa/flake8/-/merge_requests/422
.. _GitLab!424:
   https://gitlab.com/pycqa/flake8/-/merge_requests/424
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/flake8
  - Changelog: https://pyup.io/changelogs/flake8/
  - Repo: https://gitlab.com/pycqa/flake8
</details>



Co-authored-by: pyup-bot <github-bot@pyup.io>
Co-authored-by: Ellen Marie Dash <me@duckie.co>
bors bot added a commit to duckinator/bork that referenced this issue May 14, 2020
139: Update flake8 to 3.8.1 r=duckinator a=pyup-bot


This PR updates [flake8](https://pypi.org/project/flake8) from **3.7.9** to **3.8.1**.



<details>
  <summary>Changelog</summary>
  
  
   ### 3.8.1
   ```
   -------------------

You can view the `3.8.1 milestone`_ on GitLab for more details.

Bugs Fixed
~~~~~~~~~~

- Fix ``--output-file`` (regression in 3.8.0) (See also `GitLab!427`_,
  `GitLab637`_)


.. all links
.. _3.8.1 milestone:
    https://gitlab.com/pycqa/flake8/-/milestones/34

.. issue links
.. _GitLab637:
    https://gitlab.com/pycqa/flake8/issues/637

.. merge request links
.. _GitLab!427:
    https://gitlab.com/pycqa/flake8/merge_requests/427
   ```
   
  
  
   ### 3.8.0
   ```
   -------------------

You can view the `3.8.0 milestone`_ on GitLab for more details.

Bugs Fixed
~~~~~~~~~~

- Fix logical checks which report positions out of bounds (See also
  `GitLab!422`_, `GitLab635`_)

- Fix ``--exclude=.*`` accidentally matching ``.`` and ``..`` (See also
  `GitLab!424`_, `GitLab632`_)

Deprecations
~~~~~~~~~~~~

- Add deprecation message for vcs hooks (See also `GitLab!420`_,
  `GitLab568`_)
   ```
   
  
  
   ### 3.8.0a2
   ```
   ---------------------

You can view the `3.8.0 milestone`_ on GitLab for more details.

Bugs Fixed
~~~~~~~~~~

- Fix ``type=&quot;str&quot;`` optparse options (See also `GitLab!419`_)
   ```
   
  
  
   ### 3.8.0a1
   ```
   ---------------------

You can view the `3.8.0 milestone`_ on GitLab for more details.

New Dependency Information
~~~~~~~~~~~~~~~~~~~~~~~~~~

- Remove dependency on ``entrypoints`` and add dependency on
  ``importlib-metadata`` (only for ``python&lt;3.8``) (See also `GitLab!388`_,
  `GitLab569`_)

- Pyflakes has been updated to &gt;= 2.2.0, &lt; 2.3.0 (See also `GitLab!417`_)

- pycodestyle has been updated to &gt;= 2.6.0a1, &lt; 2.7.0 (See also `GitLab!418`_)

Features
~~~~~~~~

- Add ``--extend-exclude`` option to add to ``--exclude`` without overwriting
  (See also `GitLab!315`_, `GitLab535`_)

- Move argument parsing from ``optparse`` to ``argparse`` (See also
  `GitLab!341`_

- Group plugin options in ``--help`` (See also `GitLab!342`_, `GitLab565`_)

- Remove parsing of ``verbose`` from configuration files as it was not
  consistently applied (See also `GitLab!360`_, `GitLab439`_)

- Remove parsing of ``output_file`` from configuration files as it was not
  consistently applied (See also `GitLab!361`_)

- Resolve configuration files relative to ``cwd`` instead of common prefix of
  passed filenames.  You may need to change ``flake8 subproject`` to
  ``cd subproject &amp;&amp; flake8 .`` (See also `GitLab!363`_)

- Officially support python3.8 (See also `GitLab!377`_)

- ``--disable-noqa`` now also disables `` flake8: noqa`` (See also
  `GitLab!380`_, `GitLab590`_)

- Ensure that a missing file produces a ``E902`` error (See also `GitLab!404`_,
  `GitLab600`_)

- `` noqa`` comments now apply to all of the lines in an explicit ``\``
  continuation or in a line continued by a multi-line string (See also
  `GitLab!413`_, `GitLab375`_)

Bugs Fixed
~~~~~~~~~~

- Fix ``--exclude=./t.py`` to only match ``t.py`` at the top level (See also
  `GitLab!311`_, `GitLab382`_)

- Fix ``--show-source`` when a file is indented with tabs (See also
  `GitLab!339`_, `GitLab563`_)

- Fix crash when ``--max-line-length`` is given a non-integer (See also
  `GitLab!341`_, `GitLab541`_)

- Prevent flip-flopping of ``indent_char`` causing extra ``E101`` errors (See
  also `GitLab!357`_, `pycodestyle886`_)

- Only enable multiprocessing when the method is ``fork`` fixing issues
  on macos with python3.8+ (See also `GitLab!366`_, `GitLab587`_) (note: this
  fix also landed in 3.7.9)

- ``noqa`` is now only handled by flake8 fixing specific-noqa.  Plugins
  requesting this parameter will always receive ``False`` (See also
  `GitLab!331`_, `GitLab552`_)

- Fix duplicate loading of plugins when invoked via ``python -m flake8`` (See
  also `GitLab!388`_)

- Fix early exit when ``--exit-zero`` and ``--diff`` are provided and the diff
  is empty (See also `GitLab!391`_)

- Consistently split lines when ``\f`` is present when reading from stdin (See
  also `GitLab!406`_, `GitLab270`_)

Deprecations
~~~~~~~~~~~~

- ``python setup.py flake8`` (setuptools integration) is now deprecated and
  will be removed in a future version (See also `GitLab!330`_, `GitLab544`_)

- ``type=&#39;string&#39;`` (optparse) types are deprecated, use
  ``type=callable`` (argparse) instead.  Support for ``type=&#39;string&#39;`` will
  be removed in a future version (See also `GitLab!341`_)

- ``%default`` in plugin option help text is deprecated, use ``%(default)s``
  instead.  Support for ``%default`` will be removed in a future version (See
  also `GitLab!341`_)

- optparse-style ``action=&#39;callback&#39;`` setting for options is deprecated, use
  argparse action classes instead.  This will be removed in a future version
  (See also `GitLab!341`_)


.. all links
.. _3.8.0 milestone:
    https://gitlab.com/pycqa/flake8/-/milestones/32

.. merge request links
.. _GitLab270:
   https://gitlab.com/pycqa/flake8/-/issues/270
.. _GitLab375:
   https://gitlab.com/pycqa/flake8/-/issues/375
.. _GitLab382:
   https://gitlab.com/pycqa/flake8/-/issues/382
.. _GitLab439:
   https://gitlab.com/pycqa/flake8/-/issues/439
.. _GitLab535:
   https://gitlab.com/pycqa/flake8/-/issues/535
.. _GitLab541:
   https://gitlab.com/pycqa/flake8/-/issues/541
.. _GitLab544:
   https://gitlab.com/pycqa/flake8/-/issues/544
.. _GitLab552:
   https://gitlab.com/pycqa/flake8/-/issues/552
.. _GitLab563:
   https://gitlab.com/pycqa/flake8/-/issues/563
.. _GitLab565:
   https://gitlab.com/pycqa/flake8/-/issues/565
.. _GitLab568:
   https://gitlab.com/pycqa/flake8/-/issues/568
.. _GitLab569:
   https://gitlab.com/pycqa/flake8/-/issues/569
.. _GitLab587:
   https://gitlab.com/pycqa/flake8/-/issues/587
.. _GitLab590:
   https://gitlab.com/pycqa/flake8/-/issues/590
.. _GitLab600:
   https://gitlab.com/pycqa/flake8/-/issues/600
.. _GitLab632:
   https://gitlab.com/pycqa/flake8/-/issues/632
.. _GitLab635:
   https://gitlab.com/pycqa/flake8/-/issues/635
.. _pycodestyle886:
   PyCQA/pycodestyle#886

.. issue links
.. _GitLab!311:
   https://gitlab.com/pycqa/flake8/-/merge_requests/311
.. _GitLab!315:
   https://gitlab.com/pycqa/flake8/-/merge_requests/315
.. _GitLab!330:
   https://gitlab.com/pycqa/flake8/-/merge_requests/330
.. _GitLab!331:
   https://gitlab.com/pycqa/flake8/-/merge_requests/331
.. _GitLab!339:
   https://gitlab.com/pycqa/flake8/-/merge_requests/339
.. _GitLab!341:
   https://gitlab.com/pycqa/flake8/-/merge_requests/341
.. _GitLab!342:
   https://gitlab.com/pycqa/flake8/-/merge_requests/342
.. _GitLab!357:
   https://gitlab.com/pycqa/flake8/-/merge_requests/357
.. _GitLab!360:
   https://gitlab.com/pycqa/flake8/-/merge_requests/360
.. _GitLab!361:
   https://gitlab.com/pycqa/flake8/-/merge_requests/361
.. _GitLab!363:
   https://gitlab.com/pycqa/flake8/-/merge_requests/363
.. _GitLab!366:
   https://gitlab.com/pycqa/flake8/-/merge_requests/366
.. _GitLab!377:
   https://gitlab.com/pycqa/flake8/-/merge_requests/377
.. _GitLab!380:
   https://gitlab.com/pycqa/flake8/-/merge_requests/380
.. _GitLab!388:
   https://gitlab.com/pycqa/flake8/-/merge_requests/388
.. _GitLab!391:
   https://gitlab.com/pycqa/flake8/-/merge_requests/391
.. _GitLab!404:
   https://gitlab.com/pycqa/flake8/-/merge_requests/404
.. _GitLab!406:
   https://gitlab.com/pycqa/flake8/-/merge_requests/406
.. _GitLab!413:
   https://gitlab.com/pycqa/flake8/-/merge_requests/413
.. _GitLab!417:
   https://gitlab.com/pycqa/flake8/-/merge_requests/417
.. _GitLab!418:
   https://gitlab.com/pycqa/flake8/-/merge_requests/418
.. _GitLab!419:
   https://gitlab.com/pycqa/flake8/-/merge_requests/419
.. _GitLab!420:
   https://gitlab.com/pycqa/flake8/-/merge_requests/420
.. _GitLab!422:
   https://gitlab.com/pycqa/flake8/-/merge_requests/422
.. _GitLab!424:
   https://gitlab.com/pycqa/flake8/-/merge_requests/424
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/flake8
  - Changelog: https://pyup.io/changelogs/flake8/
  - Repo: https://gitlab.com/pycqa/flake8
</details>



Co-authored-by: pyup-bot <github-bot@pyup.io>
@asottile asottile changed the title E101 checker misreports issue with triple-quote literal after # noqa: E101 is specified on the "right block" E101: checker misreports issue with triple-quote literal after # noqa: E101 is specified on the "right block" Jun 14, 2020
@Zac-HD
Copy link
Member

Zac-HD commented Sep 22, 2021

I encountered what I think is the same problem, and reduced it to the following case:

"""
	this is tab-indented, and it's not code at all
"""

while True:
    pass  # this is four-space-indented
$ pycodestyle t.py
t.py:2:1: W191 indentation contains tabs
t.py:6:1: E101 indentation contains mixed spaces and tabs

which makes it look like a duplicate of #376.

@asottile
Copy link
Member

yeah I agree on duplicate -- let's coordinate there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants