diff --git a/README.md b/README.md index 7c343874..43ee430c 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ It supports: * [_PerlCritic_](https://github.com/Perl-Critic) * [_PiTest_](http://pitest.org/) * [_PyDocStyle_](https://pypi.python.org/pypi/pydocstyle) - * [_PyLint_](https://www.pylint.org/) + * [_PyLint_](https://www.pylint.org/) with `pylint --output-format=parseable`. * [_PMD_](https://pmd.github.io/) * [_Infer_](http://fbinfer.com/) Facebook Infer. With `--pmd-xml`. * [_PHPPMD_](https://phpmd.org/) with `phpmd api.php xml ruleset.xml`. diff --git a/src/main/java/se/bjurr/violations/lib/parsers/PyLintParser.java b/src/main/java/se/bjurr/violations/lib/parsers/PyLintParser.java index 03216890..417de581 100644 --- a/src/main/java/se/bjurr/violations/lib/parsers/PyLintParser.java +++ b/src/main/java/se/bjurr/violations/lib/parsers/PyLintParser.java @@ -10,19 +10,20 @@ import java.util.ArrayList; import java.util.List; + import se.bjurr.violations.lib.model.SEVERITY; import se.bjurr.violations.lib.model.Violation; /** * PyLint.
* - * pylint --output-format=parseable --reports=n voluptuous + * pylint --output-format=parseable * */ public class PyLintParser implements ViolationsParser { @Override - public List parseReportOutput(String string) throws Exception { + public List parseReportOutput(final String string) throws Exception { final List violations = new ArrayList<>(); final List> partsPerLine = getLines(string, "([^:]*):(\\d+): \\[(\\D)(\\d*)\\(([^\\]]*)\\), ([^\\]]*)] (.*)"); diff --git a/src/test/resources/pylint/pylint3.txt b/src/test/resources/pylint/pylint3.txt new file mode 100644 index 00000000..bba9261e --- /dev/null +++ b/src/test/resources/pylint/pylint3.txt @@ -0,0 +1,16 @@ +$ pylint3 packages/myproject/ +No config file found, using default configuration +************* Module packages.myproject.main +C: 15, 0: Invalid constant name "logger" (invalid-name) +C: 31, 0: Invalid argument name "rt" (invalid-name) +************* Module packages.myproject.feed +C: 34, 0: Line too long (116/100) (line-too-long) +C: 35, 0: Trailing whitespace (trailing-whitespace) +C: 74, 0: Exactly one space required before assignment + unsed4= "jdajhkadshjkdaskhjdsahj" + ^ (bad-whitespace) +C:131, 0: Exactly one space required after assignment + hello =4 + ^ (bad-whitespace) +C:132, 0: Trailing whitespace (trailing-whitespace) +C:132, 0: Line too long (102/100) (line-too-long)