-
Notifications
You must be signed in to change notification settings - Fork 25
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
added whitelisting #27
Conversation
First I introduced the whitelist feature with a global variable but could not find a way of testing the manipulation of the glob var. Then I put all the functions and glob vars except The whitelist check is case insensitive by default. I updated all test cases with the new class structure and added tests for my added functionality. I also added a description to the README for how to use the whitelisting feature. If you merge this PR please release the change as version 2.0 as the class structure is backwards incompatible and will break e.g. flake8-eradicate. |
Thanks! I'll let @sobolevn review this. |
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.
Hi! Let's start with the most important question:
Do we really need to refactor the public API of this project?
I am asking because, this would also break stuff that relies on eradicate
, like flake8-eradicate
: https://github.com/sobolevn/flake8-eradicate/blob/master/flake8_eradicate.py#L103
What are the reasons behind this refactor?
Ok I tried to capture my thoughts from around 2 months ago in why I did the API change: First I tried to implement the whitelist feature with the current API. I thought of using glob variables containing the whitelist stuff and change them when the user changes the default whitelist (with new args: Another thought was to init a variable containing the whitelist and pass it form the So the problem was the context which needs to be shared. For that reason I put the functions into a class. Honestly I did not change that much. When you compare the two file versions side by side you can see that I only did the "class-rewrite", added two args for CLI and the the whitelist-regex-feature. The API is also pretty easy to update: IMO this change is for the better and would also come in handy for potential future additions. |
Ok, fair enough! I will proceed to review our code than! 👍 |
If you want me to I could make the PR for If you have other questions please feel free to ask 😉 |
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.
First round is done! 👍
Fixed stuff mentioned in your review .. 2 points are open .. see above |
All requested changes are done |
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.
Awesome! There's almost everything fixed!
Moved all regex to class const One question remains .. see above |
Since it is the first PR I merge, I kindly ask @myint to review it as well. |
@sobolevn any update on this? We want to introduce flake8-eradicate to our project and this is blocking us 😊 |
Merged! Now, we would have to figure out how to release it! 😆 |
@myint there are three options:
Which one does look the best to you? |
Thanks! I've chosen option 2 for expediency. Feel free to enable automatic publishing as needed. I don't think I've set that up in any of my github.com repositories before. |
@sobolevn Will you release the change as version |
Yes, next week. Thanks for the reminder! 👍 |
Multiple issues with false positives motivated me to add a whitelisting feature.
You can extend the default whitelist or overwrite it from command line.
Whitelist entries are interpreted as regex.
Currently the regex check is case sensitive. A single entry can be made case insensitive by adding
(?i)
like above fornoqa
.Maybe case insensitivity by default is okay?
What other defaults do you know that should be added?
I'm currently working on the tests and will also update the README afterwards.
Closes #19 PR for manually ignoring
TODO
which is covered by this PRFixes #25
Fixes #24
Fixes #16
Fixes #15
Fixes #11
Resolves #26
EDIT: Please see comment(s) below