-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Allow disabling duplicate-code
with a disable comment
#5446
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
Conversation
Pull Request Test Coverage Report for Build 1933646682
💛 - Coveralls |
Good to see |
Is there no way to easily take the disable into account when launched as a standalone ? If not I think it's fair enough, being able to disable when run with pylint is one of the most asked feature so having this one is pretty important. |
Well, the issue with that is that the |
if hasattr(self, "linter"): | ||
# Remove those lines that should be ignored because of disables | ||
for index, line in enumerate(readlines()): | ||
if self.linter._is_one_message_enabled("R0801", index + 1): # type: ignore[attr-defined] |
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.
That's pretty clever.
Maybe we can instead instantiate a PyLinter with |
Haven't looked into that, but that kind of defeats the purpose of having this be a stand-alone tool. You would then also get all the overhead of configuration loading etc. Personally I think we should be fine with adding this and then even closing the issue. |
Right, it's possible to launch pylint with |
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.
There's currently 121 👍 on the original issue, safe to say (1) you're going made a lot of person happy with this one 😄
(1) unless a catastrophic failure condition eluded me during review 😂
Yeah I completely forgot about this, but my response saying that I had a potential fix also got 12 👍... I'll do one final review as this was quite long ago and then I'll merge (if that's okay with you of course!). |
Merging this! @earonesty also thanks for your review! |
doc/whatsnew/<current release.rst>
.Type of Changes
Description
Please read
The most important reason why nobody could get this to work (I think) is because the similarity check can be ran stand-alone. I'm not sure what the rationale for this is, but I think that might have caused issues for other contributors.
This PR checks whether
self
haslinter
attribute (and therefore is not being run standalone) and then checks for disables. I think this is a fair approach to the problem: if you're running the similarity checker on its own it shouldn't be disabled bypylint
type comments.I would like the opinion of maintainers though as looking at the issues and past PRs has shown that this discussion has been quite opinionated.
Potentially closes #214