Comments (3)
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.
I'm not able to reproduce this, can you post some sample code?
Also, please post the output of flake8 --version
from flake8-noqa.
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)
- require-code option should respect ignored codes
- Feature request: add option to warn about ignored codes
- Idea: "allowed_noqa" Config Option HOT 8
- Issue with noqa comment & commented out code w/ flake8-eradicate HOT 3
- multiline string with trailing comma causes false positive
- Support flake8==5 HOT 2
- Feature/rule request: require reason/description
- Superfluous and incorrect NQA102 errors
- Incorrect NQA102 error HOT 5
- Is there a way to ignore `NQA` errors? HOT 1
- LICENSE vs. COPYING.LESSER inconsistency HOT 4
- False positives when running with `--stdin-display-name` HOT 1
- Suggestion: deduplicate codes in example
- Misses comments within multi-line strings and comments HOT 3
- [Feature] Detect # noqa comments inside multiline strings
- flake8-noqa slow with VSCode HOT 2
- Allow ignoring T000 (TODO marker) HOT 2
- Support flake8==7.0.0 HOT 4
- Sometimes noqa is not on the Exact Same Line HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flake8-noqa.