question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

flake8-colors 0.1.8 breaks yesqa with pre-commit somehow

See original GitHub issue

Yesterday after you helped me with #50 everything was fine and my GH Action passed.

Today I made a commit which removed comments, updated an env-description and added a skip_install=true to another env in my tox.ini. So nothing to do with my flake8 or pre-commit setup. But the GH Action suddenly failed. I looked in the logs and yesqa - who knows why - removed multiple noqas which it did not yesterday and flake8 failed because of the missing noqas.

I looked into it and locally it also failed. I compared the dependencies which tox installed in the two CI runs and the only difference was flake8-colors which went from 0.1.6 in the successful run to 0.1.8 in the crashing one. After trying it locally flake8-colors 0.1.8 does yesqa no good. The only change worth mentioning they made is this merge. And I don’t get it why yesqa works with flake8-colors 0.1.6 but not with flake8-colors 0.1.8 😖

Whats more confusing is, that if I run yesqa manually and not via pre-commit (does not matter if via local hook, how I run it, or the “correct” way with additional_dependencies set - tested both) it succeeds.

Reproduction

I narrowed it down to this setup (which I actually tested on a windows PC, but the CI runs linux):

testfile.py:

"""
    python_test-cielquan
    ~~~~~~~~~~~~~~~~~~~~

    Test repo for python stuff

    :copyright: (c) Christian Riedel
    :license: MIT, see LICENSE for more details
"""  # noqa: D205, D208, D400

For local yesqa tests run:

$ python3.8 -m venv venv
$ . venv/bin/activate
$ pip install yesqa==1.2.2 flake8==3.8.4
$ yesqa testfile.py

See that yesqa works and removes noqa, if flake8-docstrings is not installed Add the noqa back to the file and continue with:

$ pip install flake8-colors==0.1.6 flake8-docstrings==1.5.0 pydocstyle==5.1.1
$ yesqa testfile.py
$ pip install flake8-colors==0.1.8
$ yesqa testfile.py

See that yesqa does not remove the noqa with falke8-colors 0.1.6 or 0.1.8

.pre-commit-config.yaml

repos:
  - repo: https://github.com/asottile/yesqa
    rev: v1.2.2
    hooks:
    - id: yesqa
      name: yesqa - flake8-colors==0.1.6
      additional_dependencies:
        - "flake8==3.8.4"
        - "flake8-colors==0.1.6"
        - "flake8-docstrings==1.5.0"
        - "pydocstyle==5.1.1"
      files: 'testfile\.py'
    - id: yesqa
      name: yesqa - flake8-colors==0.1.8
      additional_dependencies:
        - "flake8==3.8.4"
        - "flake8-colors==0.1.8"
        - "flake8-docstrings==1.5.0"
        - "pydocstyle==5.1.1"
      files: 'testfile\.py'

For pre-commit tests run:

$ python3.8 -m venv venv
$ . venv/bin/activate
$ pip install pre-commit==2.8.2
$ pre-commit run yesqa --all-files -v

See that the latter hook fails.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
asottilecommented, Nov 16, 2020

ok I can reproduce it now, it’s this line here which breaks passed --format:

$ flake8 '--format=%(code)s' - <<< 'import os'
D100
F401
$ flake8 '--format=%(code)s' - <<< 'import os' | cat
stdin:1:1: D100 Missing docstring in public module
stdin:1:1: F401 'os' imported but unused
Read more comments on GitHub >

github_iconTop Results From Across the Web

Supported hooks - pre-commit
reorder-python-imports - This hook reorders imports in python files. github.com/asottile/yesqa. yesqa - Automatically remove unnecessary `# noqa` comments ...
Read more >
The yesqa from asottile - GithubHelp
flake8-colors 0.1.8 breaks yesqa with pre-commit somehow. Yesterday after you helped me with #50 everything was fine and my GH Action passed.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found