-
Notifications
You must be signed in to change notification settings - Fork 172
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
[BUG] Prospector 1.8 does not respect noqa comments #557
Comments
Same here. Did some digging.
In Using Python 3.11 on arm64 |
Caused by this change: 1.7.7...1.8.0#diff-df4d4aafd70e3e43164c4f811e953de61c808b19d96616371ada4e336d8d05ceR51 |
Seems to be still present in |
There's no commit to revert as this is due to the str to Path refactor. Something need to be done differently to fix this:
|
Here's a bit of a hack fix for people who can't stand this now, and don't want to downgrade Prospector in all their projects. Update diff --git a/prospector/postfilter.py b/prospector/postfilter.py
index 17821e3..32840df 100644
--- a/prospector/postfilter.py
+++ b/prospector/postfilter.py
@@ -43,8 +43,8 @@ def filter_messages(filepaths: List[Path], messages: List[Message]) -> List[Mess
continue
# some lines are skipped entirely by messages
- if relative_message_path in lines_to_ignore:
- if message.location.line in lines_to_ignore[relative_message_path]:
+ if Path(message.location.path) in lines_to_ignore:
+ if message.location.line in lines_to_ignore[Path(message.location.path)]:
continue
# and some lines have only certain messages explicitly ignored I say hack here, as the underlying problem isn't fixed. For a proper fix, |
Pull #580 seems to do the trick. Thanks @christokur! |
After upgrading from 1.7 to 1.8, prospector does not respect
noqa
-comments anymore.How to reproduce
Create an example file to test,
example.py
:Then use Docker to test with both 1.7.7 and 1.8.2 prospector versions:
There should be 4 errors in both cases:
Now add
noqa
commentsAnd rerun both Docker commands above.
There is 0 errors for 1.7.7, as expected.
With 1.8.2, there are 3 errors for some reason:
Whats going on here?
Versions 1.8.0rc0, 1.8.0rc1, 1.8.1 and 1.8.2 all behave the same way. So something changed between 1.7.7 and 1.8.0rc0.
The text was updated successfully, but these errors were encountered: