-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,8 @@ | |
/** | ||
* PyLint. Format used by Flake8.<br> | ||
* <code> | ||
* msg-template='{path}:{line}:{column} [{msg_id}] {msg}' | ||
* msg-template(pylint)='{path1}:{line2}: [{severity4}{code5}] {msg6}' | ||
* msg-template(default)='{path1}:{line2}:{column7}: {severity8}{code9} {msg10}' | ||
* </code> | ||
*/ | ||
public class Flake8Parser implements ViolationsParser { | ||
|
@@ -29,7 +30,10 @@ public Set<Violation> parseReportOutput( | |
final String string, final ViolationsLogger violationsLogger) throws Exception { | ||
final Set<Violation> violations = new TreeSet<>(); | ||
final List<List<String>> partsPerLine = | ||
getLines(string, "([^:]*):(\\d+)?:?(\\d+)?:? \\[?(\\D+)(\\d*)\\]? (.*)"); | ||
/** | ||
* group 1 2 4 5 6 7 8 9 10 | ||
* field path line severity code msg column severity code msg */ | ||
getLines(string, "([^:]+):(\\d+):( \\[([A-Z]{1,8})([0-9]{0,6})\\] (.+)|(\\d+): ([A-Z]{1,8})([0-9]{0,6}) (.+))"); | ||
for (final List<String> parts : partsPerLine) { | ||
final String filename = parts.get(1); | ||
Integer line; | ||
|
@@ -39,12 +43,22 @@ public Set<Violation> parseReportOutput( | |
continue; | ||
} | ||
Integer column = null; | ||
if (!isNullOrEmpty(parts.get(3))) { | ||
column = parseInt(parts.get(3)); | ||
String severity = null; | ||
Check warning Code scanning / Violations Lib The initializer for variable 'severity' is never used (overwritten on lines 51 and 55) Best Practices https://pmd.github.io/pmd-6.55.0/pmd_rules_java_bestpractices.html#unusedassignment Warning
The initializer for variable 'severity' is never used (overwritten on lines 51 and 55)
Best Practices https://pmd.github.io/pmd-6.55.0/pmd\_rules\_java\_bestpractices.html#unusedassignment
|
||
String rule = null; | ||
Check warning Code scanning / Violations Lib The initializer for variable 'rule' is never used (overwritten on lines 52 and 56) Best Practices https://pmd.github.io/pmd-6.55.0/pmd_rules_java_bestpractices.html#unusedassignment Warning
The initializer for variable 'rule' is never used (overwritten on lines 52 and 56)
Best Practices https://pmd.github.io/pmd-6.55.0/pmd\_rules\_java\_bestpractices.html#unusedassignment
|
||
String message = null; | ||
Check warning Code scanning / Violations Lib The initializer for variable 'message' is never used (overwritten on lines 53 and 57) Best Practices https://pmd.github.io/pmd-6.55.0/pmd_rules_java_bestpractices.html#unusedassignment Warning
The initializer for variable 'message' is never used (overwritten on lines 53 and 57)
Best Practices https://pmd.github.io/pmd-6.55.0/pmd\_rules\_java\_bestpractices.html#unusedassignment
|
||
if (!isNullOrEmpty(parts.get(7))) { | ||
column = parseInt(parts.get(7)); | ||
severity = parts.get(8); | ||
rule = parts.get(9); | ||
message = parts.get(10); | ||
} else { | ||
severity = parts.get(4); | ||
rule = parts.get(5); | ||
message = parts.get(6); | ||
} | ||
if (isNullOrEmpty(message)) { | ||
continue; | ||
} | ||
final String severity = parts.get(4); | ||
final String rule = parts.get(5); | ||
final String message = parts.get(6); | ||
violations.add( // | ||
violationBuilder() | ||
.setParser(FLAKE8) | ||
|