Giter Site home page Giter Site logo

Comments (3)

jonyscathe avatar jonyscathe commented on May 29, 2024 1

Sorry, I thought this was simpler than it is....
In some simple test cases I don't get the issue - will try come up with a minimal reproduction of some sort.

from flake8-noqa.

plinss avatar plinss commented on May 29, 2024

I'm not able to reproduce this, can you post some sample code?

Also, please post the output of flake8 --version

from flake8-noqa.

jonyscathe avatar jonyscathe commented on May 29, 2024

Oh I am an idiot

flake8-bandit was causing a crash due to a compatibility issue with bandit which was causing errors to not show up! So nothing at all to do with flake8-bandit...

I found this "issue" while trying to track down why NQA102 wasn't coming up in some code where I knew the issue behind the original violation had been solved.

The issue we are actually having is that if we have some line with both a mypy error and a flake8 error we have to have both a type ignore and a noqa:

from pandas.core.frame import DataFrame
from pandas.core.series import Series

def load_data() -> tuple[Series, DataFrame, DataFrame]:  # type: ignore[type-arg] # noqa: FNE004

That all works fine. Then if we change the function name so that FNE004 isn't an issue anymore:

from pandas.core.frame import DataFrame
from pandas.core.series import Series

def load_data_from_file() -> tuple[Series, DataFrame, DataFrame]:  # type: ignore[type-arg] # noqa: FNE004

Then we do not get any NQA102 errors.

So basically:

def load_data() -> tuple[Series, DataFrame, DataFrame]:  # type: ignore[type-arg] # noqa: FNE004

gives no errors correctly

def load_data_from_file() -> tuple[Series, DataFrame, DataFrame]:  # type: ignore[type-arg] # noqa: FNE004

gives no errors, but should give NQA102

def load_data_from_file() -> tuple[Series, DataFrame, DataFrame]:  # type: ignore[type-arg]

Raises a FNE004

def load_data_from_file() -> tuple[Series, DataFrame, DataFrame]:  # noqa: FNE004

Raises an NQA102 (and a mypy error)

I think it is just an issue where flake8-noqa doesn't recognise the noqa comment if it is after any other comment.
And the only possible way to suppress a mypy and flake8 error on the same line is to use the style # type: ignore[code] # noqa: code

from flake8-noqa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.