Skip to content
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

Make min-similarity-lines == 0 stop similarity check #4970

Merged
merged 4 commits into from Sep 7, 2021

Conversation

DanielNoord
Copy link
Collaborator

  • Add yourself to CONTRIBUTORS if you are a new contributor.
  • Add a ChangeLog entry describing what your PR does.
  • If it's a new feature, or an important bug fix, add a What's New entry in
    doc/whatsnew/<current release.rst>.
  • Write a good description on what the PR does.

Type of Changes

Type
🐛 Bug fix
✨ New feature

Description

This makes it so that setting min-similarity-lines to zero exits the
similarity code checker with a successful exit.
This closes #4901

This makes it so that setting ``min-similarity-lines`` to zero exit the
similarity code checker with a successful exit.
This closes pylint-dev#4901
@Pierre-Sassoulas Pierre-Sassoulas added the Enhancement ✨ Improvement to a component label Sep 5, 2021
@coveralls
Copy link

coveralls commented Sep 5, 2021

Pull Request Test Coverage Report for Build 1205498418

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.008%) to 93.107%

Totals Coverage Status
Change from base Build 1204663373: 0.008%
Covered Lines: 13237
Relevant Lines: 14217

💛 - Coveralls

@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.11.0 milestone Sep 5, 2021
Copy link
Member

@cdce8p cdce8p left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix won't solve the the issue if the similarity checker is executed via pylint. Only when called directly.

A better solution would probably be to insert an early return here:
https://github.com/PyCQA/pylint/blob/005b7d22c75c7c32c1dafd7b548d858c0682e58a/pylint/checkers/similar.py#L391-L393

pylint/checkers/similar.py Outdated Show resolved Hide resolved
@DanielNoord
Copy link
Collaborator Author

Would it be possible to add a test for this? Or does the unittest inherently call the module directly?

@cdce8p
Copy link
Member

cdce8p commented Sep 5, 2021

@DanielNoord Have you tried moving it to the location I suggested? The test case you wrote should already work.

@DanielNoord
Copy link
Collaborator Author

Oh no, I'm sorry! I assumed the fact that this test succeeded without actually succeeding in its intent meant that another test would be necessary. This does indeed pass. Based on your comment I don't think another test is necessary? Or am I mistaken?

pylint/checkers/similar.py Outdated Show resolved Hide resolved
@cdce8p
Copy link
Member

cdce8p commented Sep 5, 2021

Based on your comment I don't think another test is necessary? Or am I mistaken?

No. The test does already cover it.

@DanielNoord
Copy link
Collaborator Author

Changed! Sorry for taking up so much of your time these past days, I will try and be more thorough in future PR's!

@cdce8p
Copy link
Member

cdce8p commented Sep 5, 2021

Changed! Sorry for taking up so much of your time these past days, I will try and be more thorough in future PR's!

Don't worry too much about it. I understand that it feels good to open a lot of different PRs. Just from a reviewer perspective it's sometimes better to take it a bit slower.

@Pierre-Sassoulas Pierre-Sassoulas merged commit cf33d82 into pylint-dev:main Sep 7, 2021
@DanielNoord DanielNoord deleted the min-similarity-line-0 branch September 7, 2021 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ✨ Improvement to a component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting min-similarity-lines to 0 should stop pylint from checking duplicate code
4 participants