Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parse pylint report such that duplicate code violations will flag all
involved files, not just one
- Loading branch information
1 parent
0a200e6
commit 52d1b45
Showing
6 changed files
with
192 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
diff --git a/fileone.py b/fileone.py | ||
index e69de29..3952627 100644 | ||
--- a/fileone.py | ||
+++ b/fileone.py | ||
@@ -0,0 +1,16 @@ | ||
+""" | ||
+Fileone | ||
+""" | ||
+def selection_sort(to_sort): | ||
+ """ | ||
+ The greatest sorting algorithm? | ||
+ """ | ||
+ new_list = [] | ||
+ final_size = len(to_sort) | ||
+ while len(new_list) < final_size: | ||
+ candidate_index = 0 | ||
+ for index in xrange(len(to_sort)): | ||
+ if to_sort[index] <= to_sort[candidate_index]: | ||
+ candidate_index = index | ||
+ new_list.append(to_sort.pop(candidate_index)) | ||
+ return new_list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
************* Module filetwo | ||
filetwo.py:1: [R0801(duplicate-code), ] Similar lines in 2 files | ||
==fileone:3 | ||
==filetwo:3 | ||
def selection_sort(to_sort): | ||
""" | ||
The greatest sorting algorithm? | ||
""" | ||
new_list = [] | ||
final_size = len(to_sort) | ||
while len(new_list) < final_size: | ||
candidate_index = 0 | ||
for index in xrange(len(to_sort)): | ||
if to_sort[index] <= to_sort[candidate_index]: | ||
candidate_index = index | ||
new_list.append(to_sort.pop(candidate_index)) | ||
return new_list | ||
|
||
|
||
Report | ||
====== | ||
21 statements analysed. | ||
|
||
Statistics by type | ||
------------------ | ||
|
||
+---------+-------+-----------+-----------+------------+---------+ | ||
|type |number |old number |difference |%documented |%badname | | ||
+=========+=======+===========+===========+============+=========+ | ||
|module |2 |2 |= |100.00 |0.00 | | ||
+---------+-------+-----------+-----------+------------+---------+ | ||
|class |0 |0 |= |0 |0 | | ||
+---------+-------+-----------+-----------+------------+---------+ | ||
|method |0 |0 |= |0 |0 | | ||
+---------+-------+-----------+-----------+------------+---------+ | ||
|function |2 |2 |= |100.00 |0.00 | | ||
+---------+-------+-----------+-----------+------------+---------+ | ||
|
||
|
||
|
||
Raw metrics | ||
----------- | ||
|
||
+----------+-------+------+---------+-----------+ | ||
|type |number |% |previous |difference | | ||
+==========+=======+======+=========+===========+ | ||
|code |20 |52.63 |20 |= | | ||
+----------+-------+------+---------+-----------+ | ||
|docstring |12 |31.58 |12 |= | | ||
+----------+-------+------+---------+-----------+ | ||
|comment |0 |0.00 |0 |= | | ||
+----------+-------+------+---------+-----------+ | ||
|empty |6 |15.79 |6 |= | | ||
+----------+-------+------+---------+-----------+ | ||
|
||
|
||
|
||
Duplication | ||
----------- | ||
|
||
+-------------------------+-------+---------+-----------+ | ||
| |now |previous |difference | | ||
+=========================+=======+=========+===========+ | ||
|nb duplicated lines |13 |13 |= | | ||
+-------------------------+-------+---------+-----------+ | ||
|percent duplicated lines |40.625 |40.625 |= | | ||
+-------------------------+-------+---------+-----------+ | ||
|
||
|
||
|
||
Messages by category | ||
-------------------- | ||
|
||
+-----------+-------+---------+-----------+ | ||
|type |number |previous |difference | | ||
+===========+=======+=========+===========+ | ||
|convention |0 |0 |= | | ||
+-----------+-------+---------+-----------+ | ||
|refactor |1 |1 |= | | ||
+-----------+-------+---------+-----------+ | ||
|warning |0 |0 |= | | ||
+-----------+-------+---------+-----------+ | ||
|error |0 |0 |= | | ||
+-----------+-------+---------+-----------+ | ||
|
||
|
||
|
||
Messages | ||
-------- | ||
|
||
+---------------+------------+ | ||
|message id |occurrences | | ||
+===============+============+ | ||
|duplicate-code |1 | | ||
+---------------+------------+ | ||
|
||
|
||
|
||
Global evaluation | ||
----------------- | ||
Your code has been rated at 9.52/10 (previous run: 9.52/10, +0.00) | ||
|
12 changes: 12 additions & 0 deletions
12
diff_cover/tests/fixtures/pylint_dupe_violations_report.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
------------- | ||
Diff Quality | ||
Quality Report: pylint | ||
Diff: origin/master...HEAD, staged, and unstaged changes | ||
------------- | ||
fileone.py (93.8%): | ||
3: R0801: (duplicate-code), : Similar lines in 2 files | ||
------------- | ||
Total: 16 lines | ||
Violations: 1 line | ||
% Quality: 93% | ||
------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters