diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-07-01 14:06:25 +0200 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-07-01 14:17:44 +0200 |
commit | d1048a15618c136d9f6621692495abf70e5cfa5a (patch) | |
tree | 184ef5b8daf0187de3c6aa15de28f4b180ce1e74 | |
parent | c983d7d7620db90b82d13d3aa8cc48c8d7b96085 (diff) | |
download | pylint-git-d1048a15618c136d9f6621692495abf70e5cfa5a.tar.gz |
[duplicate-code] Remove trailing whitespaces in similarity report
And fix tests/checkers/unittest_similar.py that required to have some
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | pylint/checkers/similar.py | 2 | ||||
-rw-r--r-- | tests/checkers/unittest_similar.py | 2 |
3 files changed, 5 insertions, 2 deletions
@@ -22,6 +22,9 @@ Release date: TBA Closes #4648 +* The ``similarity`` checker no longer add three trailing whitespaces for + empty lines in its report. + What's New in Pylint 2.9.2? =========================== diff --git a/pylint/checkers/similar.py b/pylint/checkers/similar.py index 77c762294..8cddb6130 100644 --- a/pylint/checkers/similar.py +++ b/pylint/checkers/similar.py @@ -127,7 +127,7 @@ class Similar: report += f"=={line_set.name}:{idx}\n" if line_set: for line in line_set._real_lines[idx : idx + number]: - report += f" {line.rstrip()}\n" + report += f" {line.rstrip()}\n" if line.rstrip() else "\n" duplicated_line_number += number * (len(files) - 1) total_line_number: int = sum(len(lineset) for lineset in self.linesets) report += "TOTAL lines={} duplicates={} percent={:.2f}\n".format( diff --git a/tests/checkers/unittest_similar.py b/tests/checkers/unittest_similar.py index 752c32bb6..3623f4f43 100644 --- a/tests/checkers/unittest_similar.py +++ b/tests/checkers/unittest_similar.py @@ -175,7 +175,7 @@ def test_ignore_signatures_fail(): arg5: int = 5 ) -> Ret1: pass - + def example(): """Valid function definition with docstring only.""" TOTAL lines=29 duplicates=10 percent=34.48 |