-
Notifications
You must be signed in to change notification settings - Fork 157
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
Ignore results annotated with '# noqa' #195
Conversation
Pull Request Test Coverage Report for Build 727
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! I think the feature doesn't add too much complexity after all. Using issue codes is a good idea, I think. We should probably print them in the normal output as well.
@jendrikseipp should I'm asking because my guess is that most folks would only import Vulture, if using the API ( |
da06b81
to
17ee6c4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there :-) Obviously, this also needs tests, preferably in a new file. When writing new tests, check if pytest.mark.parametrize could be useful. Maybe there's already an example for that in the codebase.
Another thing I was pondering about. We don't start ignoring from vulture import Vulture
v = Vulture()
v.scan('import this # noqa: V004')
print(v.unused_imports) Should we move the |
Good idea! This aligns better with the existing code for ignoring things. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be good to separate testing the regex and testing ignoring unused code. For the former, I think we can use the test cases from the flake8 comment as test cases (plus some examples we don't want to recognize).
TODO:
|
Could you also add a test that verifies that we fixed the "or vs. union" bug? |
The way I've added the tests is basically ensuring that an example of the same issue code is covered in both categories - |
But, now that I come think of it, I haven't added isolated cases - just |
3646f9c
to
bb60ebc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Here are some more nitpicks :-)
Thanks for the additional changes! I edited README.md slightly. Could you please resolve the merge conflicts? Then I can merge the PR. |
@jendrikseipp, thanks for your timely reviews, and help on this! :-) |
Hey,
Description
This PR isn't production-ready by any means, but I just wanted to have an idea about the complexity it would add to Vulture to support
# noqa
comments. I'd be happy to add tests and documentation, once we all settle if it would be a good idea to carry this forward.Another change with the introduction of
# noqa
comments would be the introduction of issue codes (it's possible without these as well, but would hurt specificity). For now, I've just addedV001
,V002
, ... - the nomenclature for these issue codes is another thing to think about.Related Issue
#160, #182, #190
Checklist: