flake8 icon indicating copy to clipboard operation
flake8 copied to clipboard

Flake8 v6.0.0 throws "imported but unused" for type annotations in comments

Open joshbrooks opened this issue 4 years ago • 4 comments

how did you install flake8?

pip install flake8

unmodified output of flake8 --bug-report

{
  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.8.10",
    "system": "Linux"
  },
  "plugins": [
    {
      "plugin": "mccabe",
      "version": "0.7.0"
    },
    {
      "plugin": "pycodestyle",
      "version": "2.10.0"
    },
    {
      "plugin": "pyflakes",
      "version": "3.0.0"
    }
  ],
  "version": "6.0.0"
}

describe the problem

what I expected to happen

This looks like a regression in version 6.0.0, in previous versions type annotations in comments are passed.

Given code somewhat like the following

sample code

from mptt.models import MPTTModel


def some_func(thing):
            parent = thing.model  # type: MPTTModel

version 5: passes

version 6: fails with

./audit_log/models.py:17:1: F401 'mptt.models.MPTTModel' imported but unused

commands ran

$ flake8 .
...

joshbrooks avatar Nov 24 '22 03:11 joshbrooks

flake8 does not implement any checks

asottile avatar Nov 24 '22 03:11 asottile

This seems to be caused by "pyflakes" version bump

joshbrooks avatar Nov 24 '22 06:11 joshbrooks

@joshbrooks I don't understand your thumbs down -- you skipped the issue prompt where it tells you where to report issues with F__ codes, then you ignored the prompt in the issue form itself which says NOTE: flake8 is a linting framework and does not implement any checks

asottile avatar Nov 24 '22 06:11 asottile

Thanks for the explanation, I should have read more carefully before opening the issue. My sincere apologies.

The thumbs down has been removed, it was intended to indicate that the comment closing the issue didn't provide sufficient detail

joshbrooks avatar Nov 24 '22 07:11 joshbrooks