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

Setting min-similarity-lines to 0 should stop pylint from checking duplicate code #4901

Closed
arnu515 opened this issue Aug 23, 2021 · 1 comment · Fixed by #4970
Closed

Setting min-similarity-lines to 0 should stop pylint from checking duplicate code #4901

arnu515 opened this issue Aug 23, 2021 · 1 comment · Fixed by #4970
Assignees
Labels
duplicate-code Related to code duplication checker Enhancement ✨ Improvement to a component
Milestone

Comments

@arnu515
Copy link

arnu515 commented Aug 23, 2021

Current problem

Setting min-similarity-lines to 0 in the rcfile doesn't disable checking for duplicate code, it instead treats every line of code as duplicate and raises many errors.

Desired solution

Setting min-similarity-lines to 0 should disable the duplicate code check.

It works that way in many other linters (like flake8). Setting a numerical value in flake8 to 0 (e.g. max-line-length) disables that check.

Additional context

#214 requests being able to disable R0801, but it is still open

@arnu515 arnu515 added Enhancement ✨ Improvement to a component Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Aug 23, 2021
@Pierre-Sassoulas Pierre-Sassoulas added duplicate-code Related to code duplication checker and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Aug 23, 2021
@Pierre-Sassoulas
Copy link
Member

Pierre-Sassoulas commented Aug 23, 2021

It's a nice enhancement, thank you for opening the issue. The way to disable duplicate code is by using:

[MASTER]
disable=duplicate-code

As you saw in issue 214, it's currently impossible to disable duplicate-code in some part of the code and not the other but this is another issue entirely.

@hippo91 hippo91 self-assigned this Aug 25, 2021
DanielNoord added a commit to DanielNoord/pylint that referenced this issue Sep 5, 2021
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 this to the 2.11.0 milestone Sep 5, 2021
Pierre-Sassoulas pushed a commit that referenced this issue Sep 7, 2021
* Make ``min-similarity-lines == 0`` stop similarity check
This makes it so that setting ``min-similarity-lines`` to zero exit the
similarity code checker with a successful exit.
This closes #4901

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate-code Related to code duplication checker Enhancement ✨ Improvement to a component
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants