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

Add parser for Python coverage #103

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/main/java/edu/hm/hafner/coverage/CoverageParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,4 +207,16 @@
protected static ParsingException createEofException(final String fileName) {
return new ParsingException("Unexpected end of file '%s'", fileName);
}

protected static Value createValue(final String currentType, final int covered, final int missed) {
if (currentType.equals("COMPLEXITY")) {

Check warning on line 212 in src/main/java/edu/hm/hafner/coverage/CoverageParser.java

View check run for this annotation

ci.jenkins.io / CheckStyle

EqualsAvoidNullCheck

NORMAL: String literal expressions should be on the left side of an equals comparison.
Raw output
<p>Since Checkstyle 5.0</p><p> Checks that any combination of String literals is on the left side of an equals() comparison. Also checks for String literals assigned to some field (such as <code>someString.equals(anotherString = "text")</code>). </p><p> Rationale: Calling the <code>equals()</code> method on String literals will avoid a potential NullPointerException. Also, it is pretty common to see null checks right before equals comparisons, which is not necessary in the example below. </p><p> For example, this code: </p><pre><code> String nullString = null; nullString.equals("My_Sweet_String"); </code></pre><p>should be refactored to:</p><pre><code> String nullString = null; "My_Sweet_String".equals(nullString); </code></pre>
return new CyclomaticComplexity(covered + missed);
}
else {
var builder = new Coverage.CoverageBuilder();
return builder.withMetric(Metric.valueOf(currentType))
.withCovered(covered)
.withMissed(missed).build();
}
}
}
12 changes: 0 additions & 12 deletions src/main/java/edu/hm/hafner/coverage/parser/JacocoParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
import com.google.errorprone.annotations.CanIgnoreReturnValue;

import edu.hm.hafner.coverage.ClassNode;
import edu.hm.hafner.coverage.Coverage.CoverageBuilder;

Check warning on line 18 in src/main/java/edu/hm/hafner/coverage/parser/JacocoParser.java

View check run for this annotation

ci.jenkins.io / PMD

UnnecessaryImport

NORMAL: Unused import 'edu.hm.hafner.coverage.Coverage.CoverageBuilder'.
Raw output
Reports import statements that can be removed. They are either unused, duplicated, or the members they import are already implicitly in scope, because they're in java.lang, or the current package. <pre> <code> import java.io.File; // not used, can be removed import java.util.Collections; // used below import java.util.*; // so this one is not used import java.lang.Object; // imports from java.lang, unnecessary import java.lang.Object; // duplicate, unnecessary public class Foo { static Object emptyList() { return Collections.emptyList(); } } </code> </pre> <a href="https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryimport"> See PMD documentation. </a>
import edu.hm.hafner.coverage.CoverageParser;
import edu.hm.hafner.coverage.CyclomaticComplexity;

Check warning on line 20 in src/main/java/edu/hm/hafner/coverage/parser/JacocoParser.java

View check run for this annotation

ci.jenkins.io / PMD

UnnecessaryImport

NORMAL: Unused import 'edu.hm.hafner.coverage.CyclomaticComplexity'.
Raw output
Reports import statements that can be removed. They are either unused, duplicated, or the members they import are already implicitly in scope, because they're in java.lang, or the current package. <pre> <code> import java.io.File; // not used, can be removed import java.util.Collections; // used below import java.util.*; // so this one is not used import java.lang.Object; // imports from java.lang, unnecessary import java.lang.Object; // duplicate, unnecessary public class Foo { static Object emptyList() { return Collections.emptyList(); } } </code> </pre> <a href="https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryimport"> See PMD documentation. </a>
import edu.hm.hafner.coverage.FileNode;
import edu.hm.hafner.coverage.MethodNode;
import edu.hm.hafner.coverage.Metric;

Check warning on line 23 in src/main/java/edu/hm/hafner/coverage/parser/JacocoParser.java

View check run for this annotation

ci.jenkins.io / PMD

UnnecessaryImport

NORMAL: Unused import 'edu.hm.hafner.coverage.Metric'.
Raw output
Reports import statements that can be removed. They are either unused, duplicated, or the members they import are already implicitly in scope, because they're in java.lang, or the current package. <pre> <code> import java.io.File; // not used, can be removed import java.util.Collections; // used below import java.util.*; // so this one is not used import java.lang.Object; // imports from java.lang, unnecessary import java.lang.Object; // duplicate, unnecessary public class Foo { static Object emptyList() { return Collections.emptyList(); } } </code> </pre> <a href="https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryimport"> See PMD documentation. </a>
import edu.hm.hafner.coverage.ModuleNode;
import edu.hm.hafner.coverage.Node;
import edu.hm.hafner.coverage.PackageNode;
import edu.hm.hafner.coverage.Value;

Check warning on line 27 in src/main/java/edu/hm/hafner/coverage/parser/JacocoParser.java

View check run for this annotation

ci.jenkins.io / PMD

UnnecessaryImport

NORMAL: Unused import 'edu.hm.hafner.coverage.Value'.
Raw output
Reports import statements that can be removed. They are either unused, duplicated, or the members they import are already implicitly in scope, because they're in java.lang, or the current package. <pre> <code> import java.io.File; // not used, can be removed import java.util.Collections; // used below import java.util.*; // so this one is not used import java.lang.Object; // imports from java.lang, unnecessary import java.lang.Object; // duplicate, unnecessary public class Foo { static Object emptyList() { return Collections.emptyList(); } } </code> </pre> <a href="https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryimport"> See PMD documentation. </a>
import edu.hm.hafner.util.FilteredLog;
import edu.hm.hafner.util.PathUtil;
import edu.hm.hafner.util.SecureXmlParserFactory;
Expand Down Expand Up @@ -316,16 +316,4 @@
}
}
}

private Value createValue(final String currentType, final int covered, final int missed) {
if (VALUE_COMPLEXITY.equals(currentType)) {
return new CyclomaticComplexity(covered + missed);
}
else {
var builder = new CoverageBuilder();
return builder.withMetric(Metric.valueOf(currentType))
.withCovered(covered)
.withMissed(missed).build();
}
}
}
230 changes: 230 additions & 0 deletions src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
package edu.hm.hafner.coverage.parser;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import edu.hm.hafner.coverage.*;
import edu.hm.hafner.util.FilteredLog;
import edu.hm.hafner.util.SecureXmlParserFactory;
import edu.hm.hafner.util.TreeString;

import javax.xml.namespace.QName;
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.StartElement;
import javax.xml.stream.events.XMLEvent;
import java.io.Reader;

public class PythonParser extends CoverageParser {

Check warning on line 16 in src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java

View check run for this annotation

ci.jenkins.io / CheckStyle

MissingJavadocTypeCheck

NORMAL: Missing a Javadoc comment.

Check warning on line 16 in src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java

View check run for this annotation

ci.jenkins.io / PMD

GodClass

NORMAL: Possible God Class (WMC=56, ATFD=31, TCC=19.444%).
Raw output
The God Class rule detects the God Class design flaw using metrics. God classes do too many things, are very big and overly complex. They should be split apart to be more object-oriented. The rule uses the detection strategy described in "Object-Oriented Metrics in Practice". The violations are reported against the entire class. The rule uses metrics to implement its detection strategy. The violation message gives information about the values of these metrics: * WMC: a class complexity measure, see {% jdoc java::lang.java.metrics.JavaMetrics#WEIGHED_METHOD_COUNT %} * ATFD: a measure of how much data external data the class uses, see {% jdoc java::lang.java.metrics.JavaMetrics#ACCESS_TO_FOREIGN_DATA %} * TCC: a measure of how tightly related the methods are, see {% jdoc java::lang.java.metrics.JavaMetrics#TIGHT_CLASS_COHESION %} The rule identifies a god class by looking for classes which have all of the following properties: * High WMC * High ATFD * Low TCC See also the reference: Michele Lanza and Radu Marinescu. *Object-Oriented Metrics in Practice: Using Software Metrics to Characterize, Evaluate, and Improve the Design of Object-Oriented Systems.* Springer, Berlin, 1 edition, October 2006. Page 80. <a href="https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#godclass"> See PMD documentation. </a>
private static final java.util.logging.Logger LOGGER = java.util.logging.Logger.getLogger(PythonParser.class.getName());

private static final long serialVersionUID = -2343357235229921679L;

private static final QName COVERAGE = new QName("coverage");
private static final QName LINES_VALID = new QName("lines-valid");
private static final QName LINES_COVERED = new QName("lines-covered");
private static final QName PACKAGES = new QName("packages");
private static final QName PACKAGE = new QName("package");
private static final QName FILENAME = new QName("filename");
private static final QName CLASSES = new QName("classes");
private static final QName CLASS = new QName("class");
private static final QName METHODS = new QName("methods");

Check warning on line 29 in src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java

View check run for this annotation

ci.jenkins.io / PMD

UnusedPrivateField

NORMAL: Avoid unused private fields such as 'METHODS'.
Raw output
Detects when a private field is declared and/or assigned a value, but not used. Since PMD 6.50.0 private fields are ignored, if the fields are annotated with any annotation or the enclosing class has any annotation. Annotations often enable a framework (such as dependency injection, mocking or e.g. Lombok) which use the fields by reflection or other means. This usage can't be detected by static code analysis. Previously these frameworks where explicitly allowed by listing their annotations in the property "ignoredAnnotations", but that turned out to be prone of false positive for any not explicitly considered framework. <pre> <code> public class Something { private static int FOO = 2; // Unused private int i = 5; // Unused private int j = 6; public int addOne() { return j++; } } </code> </pre> <a href="https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#unusedprivatefield"> See PMD documentation. </a>
private static final QName LINES = new QName("lines");
private static final QName LINE = new QName("line");
private static final QName NUMBER = new QName("number");
private static final QName HITS = new QName("hits");
private static final QName NAME = new QName("name");


public PythonParser(ProcessingMode processingMode) {

Check warning on line 37 in src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java

View check run for this annotation

ci.jenkins.io / CheckStyle

MissingJavadocMethodCheck

NORMAL: Missing a Javadoc comment.

Check warning on line 37 in src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java

View check run for this annotation

ci.jenkins.io / CheckStyle

EmptyLineSeparatorCheck

NORMAL: 'CTOR_DEF' has more than 1 empty lines before.
Raw output
<p>Since Checkstyle 5.8</p><p> Checks for empty line separators after header, package, all import declarations, fields, constructors, methods, nested classes, static initializers and instance initializers. </p><p> ATTENTION: empty line separator is required between AST siblings, not after line where token is found. </p>

Check warning on line 37 in src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java

View check run for this annotation

ci.jenkins.io / PMD

MethodArgumentCouldBeFinal

NORMAL: Parameter 'processingMode' is not assigned and could be declared final.
Raw output
A method argument that is never re-assigned within the method can be declared final. <pre> <code> public void foo1 (String param) { // do stuff with param never assigning it } public void foo2 (final String param) { // better, do stuff with param never assigning it } </code> </pre> <a href="https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#methodargumentcouldbefinal"> See PMD documentation. </a>
super(processingMode);
}


@Override

Check warning on line 42 in src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java

View check run for this annotation

ci.jenkins.io / CheckStyle

EmptyLineSeparatorCheck

NORMAL: 'METHOD_DEF' has more than 1 empty lines before.
Raw output
<p>Since Checkstyle 5.8</p><p> Checks for empty line separators after header, package, all import declarations, fields, constructors, methods, nested classes, static initializers and instance initializers. </p><p> ATTENTION: empty line separator is required between AST siblings, not after line where token is found. </p>
protected ModuleNode parseReport(Reader reader, String fileName, FilteredLog log) {

Check warning on line 43 in src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java

View check run for this annotation

ci.jenkins.io / PMD

MethodArgumentCouldBeFinal

NORMAL: Parameter 'reader' is not assigned and could be declared final.
Raw output
A method argument that is never re-assigned within the method can be declared final. <pre> <code> public void foo1 (String param) { // do stuff with param never assigning it } public void foo2 (final String param) { // better, do stuff with param never assigning it } </code> </pre> <a href="https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#methodargumentcouldbefinal"> See PMD documentation. </a>

Check warning on line 43 in src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java

View check run for this annotation

ci.jenkins.io / PMD

MethodArgumentCouldBeFinal

NORMAL: Parameter 'fileName' is not assigned and could be declared final.
Raw output
A method argument that is never re-assigned within the method can be declared final. <pre> <code> public void foo1 (String param) { // do stuff with param never assigning it } public void foo2 (final String param) { // better, do stuff with param never assigning it } </code> </pre> <a href="https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#methodargumentcouldbefinal"> See PMD documentation. </a>

Check warning on line 43 in src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java

View check run for this annotation

ci.jenkins.io / PMD

MethodArgumentCouldBeFinal

NORMAL: Parameter 'log' is not assigned and could be declared final.
Raw output
A method argument that is never re-assigned within the method can be declared final. <pre> <code> public void foo1 (String param) { // do stuff with param never assigning it } public void foo2 (final String param) { // better, do stuff with param never assigning it } </code> </pre> <a href="https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#methodargumentcouldbefinal"> See PMD documentation. </a>
ModuleNode root = null;

Check warning on line 44 in src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java

View check run for this annotation

ci.jenkins.io / PMD

UnusedAssignment

NORMAL: The initializer for variable 'root' is never used (overwritten on line 56).
Raw output
Reports assignments to variables that are never used before the variable is overwritten, or goes out of scope. Unused assignments are those for which 1. The variable is never read after the assignment, or 2. The assigned value is always overwritten by other assignments before the next read of the variable. The rule doesn't consider assignments to fields except for those of `this` in a constructor, or static fields of the current class in static initializers. The rule may be suppressed with the standard `@SuppressWarnings("unused")` tag. The rule subsumes {% rule "UnusedLocalVariable" %}, and {% rule "UnusedFormalParameter" %}. Those violations are filtered out by default, in case you already have enabled those rules, but may be enabled with the property `reportUnusedVariables`. Variables whose name starts with `ignored` or `unused` are filtered out, as is standard practice for exceptions. Limitations: * The rule currently cannot know which method calls throw exceptions, or which exceptions they throw. In the body of a try block, every method or constructor call is assumed to throw. This may cause false-negatives. The only other language construct that is assumed to throw is the `throw` statement, in particular, things like `assert` statements, or NullPointerExceptions on dereference are ignored. * The rule cannot resolve assignments across constructors, when they're called with the special `this(...)` syntax. This may cause false-negatives. Both of those limitations may be partly relaxed in PMD 7. <pre> <code> class A { // this field initializer is redundant, // it is always overwritten in the constructor int f = 1; A(int f) { this.f = f; } } </code> </pre> <a href="https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#unusedassignment"> See PMD documentation. </a>
try {
var factory = new SecureXmlParserFactory();
var eventReader = factory.createXmlEventReader(reader);

while (eventReader.hasNext()) {
XMLEvent event = eventReader.nextEvent();

if (event.isStartElement()) {
var startElement = event.asStartElement();
var tagName = startElement.getName();
if (COVERAGE.equals(tagName)) {
root = new ModuleNode("");
var linesValid = getIntegerValueOf(startElement, LINES_VALID);
var linesCovered = getIntegerValueOf(startElement, LINES_COVERED);
root.addValue(createValue("LINE", linesCovered, linesValid - linesCovered));
if (readCoverage(eventReader, root, fileName) == null) {
handleEmptyResults(fileName, log);
} else {

Check warning on line 62 in src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java

View check run for this annotation

ci.jenkins.io / CheckStyle

RightCurlyCheck

NORMAL: '}' at column 25 should be alone on a line.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks the placement of right curly braces (<code>'}'</code>) for if-else, try-catch-finally blocks, while-loops, for-loops, method definitions, class definitions, constructor definitions, instance and static initialization blocks. The policy to verify is specified using the property <code> option</code>. For right curly brace of expression blocks please follow issue <a href="https://github.com/checkstyle/checkstyle/issues/5945">#5945</a>. </p>
return root;
}
}
}
}
handleEmptyResults(fileName, log);

return new ModuleNode("empty");
}
catch (XMLStreamException exception) {
throw new SecureXmlParserFactory.ParsingException(exception);
}
}

@CanIgnoreReturnValue
private ModuleNode readCoverage(final XMLEventReader reader, final ModuleNode module, String fileName)

Check warning on line 78 in src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java

View check run for this annotation

ci.jenkins.io / PMD

CognitiveComplexity

NORMAL: The method 'readCoverage(XMLEventReader, ModuleNode, String)' has a cognitive complexity of 15, current threshold is 15.
Raw output
Methods that are highly complex are difficult to read and more costly to maintain. If you include too much decisional logic within a single method, you make its behavior hard to understand and more difficult to modify. Cognitive complexity is a measure of how difficult it is for humans to read and understand a method. Code that contains a break in the control flow is more complex, whereas the use of language shorthands doesn't increase the level of complexity. Nested control flows can make a method more difficult to understand, with each additional nesting of the control flow leading to an increase in cognitive complexity. Information about Cognitive complexity can be found in the original paper here: <https://www.sonarsource.com/docs/CognitiveComplexity.pdf> By default, this rule reports methods with a complexity of 15 or more. Reported methods should be broken down into less complex components. <pre> <code> public class Foo { // Has a cognitive complexity of 0 public void createAccount() { Account account = new Account(&quot;PMD&quot;); // save account } // Has a cognitive complexity of 1 public Boolean setPhoneNumberIfNotExisting(Account a, String phone) { if (a.phone == null) { // +1 a.phone = phone; return true; } return false; } // Has a cognitive complexity of 4 public void updateContacts(List&lt;Contact&gt; contacts) { List&lt;Contact&gt; contactsToUpdate = new ArrayList&lt;Contact&gt;(); for (Contact contact : contacts) { // +1 if (contact.department.equals(&quot;Finance&quot;)) { // +2 (nesting = 1) contact.title = &quot;Finance Specialist&quot;; contactsToUpdate.add(contact); } else if (contact.department.equals(&quot;Sales&quot;)) { // +1 contact.title = &quot;Sales Specialist&quot;; contactsToUpdate.add(contact); } } // save contacts } } </code> </pre> <a href="https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#cognitivecomplexity"> See PMD documentation. </a>

Check warning on line 78 in src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java

View check run for this annotation

ci.jenkins.io / PMD

MethodArgumentCouldBeFinal

NORMAL: Parameter 'fileName' is not assigned and could be declared final.
Raw output
A method argument that is never re-assigned within the method can be declared final. <pre> <code> public void foo1 (String param) { // do stuff with param never assigning it } public void foo2 (final String param) { // better, do stuff with param never assigning it } </code> </pre> <a href="https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#methodargumentcouldbefinal"> See PMD documentation. </a>
throws XMLStreamException {
while (reader.hasNext()) {
XMLEvent event = reader.nextEvent();

if (event.isStartElement()) {
var startElement = event.asStartElement();
if (PACKAGES.equals(startElement.getName())) {
readPackages(reader, module, fileName);
}
} else if (event.isEndElement()) {

Check warning on line 88 in src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java

View check run for this annotation

ci.jenkins.io / CheckStyle

RightCurlyCheck

NORMAL: '}' at column 13 should be alone on a line.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks the placement of right curly braces (<code>'}'</code>) for if-else, try-catch-finally blocks, while-loops, for-loops, method definitions, class definitions, constructor definitions, instance and static initialization blocks. The policy to verify is specified using the property <code> option</code>. For right curly brace of expression blocks please follow issue <a href="https://github.com/checkstyle/checkstyle/issues/5945">#5945</a>. </p>
var endElement = event.asEndElement();
if (COVERAGE.equals((endElement.getName()))) {

Check warning on line 90 in src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java

View check run for this annotation

ci.jenkins.io / PMD

UselessParentheses

NORMAL: Useless parentheses.
Raw output
Parenthesized expressions are used to override the default operator precedence rules. Parentheses whose removal would not change the relative nesting of operators are unnecessary, because they don't change the semantics of the enclosing expression. Some parentheses that strictly speaking are unnecessary, may still be considered useful for readability. This rule allows to ignore violations on two kinds of unnecessary parentheses: - "Clarifying" parentheses, which separate operators of difference precedence. While unnecessary, they make precedence rules explicit, which may be useful for rarely used operators. For example: ```java (a + b) & c // is equivalent to `a + b & c`, but probably clearer ``` Unset the property `ignoreClarifying` to report them. - "Balancing" parentheses, which are unnecessary but visually balance out another pair of parentheses around an equality operator. For example, those two expressions are equivalent: ```java (a == null) != (b == null) a == null != (b == null) ``` The parentheses on the right are required, and the parentheses on the left are just more visually pleasing. Unset the property `ignoreBalancing` to report them. <pre> <code> public class Foo { { int n = 0; n = (n); // here n = (n * 2) * 3; // and here n = n * (2 * 3); // and here } } </code> </pre> <a href="https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#uselessparentheses"> See PMD documentation. </a>
if (module.hasChildren()) {
return module;
} else {

Check warning on line 93 in src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java

View check run for this annotation

ci.jenkins.io / CheckStyle

RightCurlyCheck

NORMAL: '}' at column 21 should be alone on a line.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks the placement of right curly braces (<code>'}'</code>) for if-else, try-catch-finally blocks, while-loops, for-loops, method definitions, class definitions, constructor definitions, instance and static initialization blocks. The policy to verify is specified using the property <code> option</code>. For right curly brace of expression blocks please follow issue <a href="https://github.com/checkstyle/checkstyle/issues/5945">#5945</a>. </p>
return null;
}
}
}
}
throw createEofException(fileName);
}

@CanIgnoreReturnValue
private Node readPackages(final XMLEventReader reader, final ModuleNode root, final String fileName) throws XMLStreamException {
while (reader.hasNext()) {
var event = reader.nextEvent();
if (event.isStartElement()) {
var startElement = event.asStartElement();
if (PACKAGE.equals(startElement.getName())) {
readPackage(reader, root, startElement, fileName);
}
} else if (event.isEndElement()) {

Check warning on line 111 in src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java

View check run for this annotation

ci.jenkins.io / CheckStyle

RightCurlyCheck

NORMAL: '}' at column 13 should be alone on a line.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks the placement of right curly braces (<code>'}'</code>) for if-else, try-catch-finally blocks, while-loops, for-loops, method definitions, class definitions, constructor definitions, instance and static initialization blocks. The policy to verify is specified using the property <code> option</code>. For right curly brace of expression blocks please follow issue <a href="https://github.com/checkstyle/checkstyle/issues/5945">#5945</a>. </p>
var endElement = event.asEndElement();
if (PACKAGES.equals(endElement.getName())) {
return root;
}
}
}
throw createEofException(fileName);
}

@CanIgnoreReturnValue
private PackageNode readPackage(final XMLEventReader reader, final ModuleNode root, final StartElement startElement, String fileName)

Check warning on line 122 in src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java

View check run for this annotation

ci.jenkins.io / PMD

MethodArgumentCouldBeFinal

NORMAL: Parameter 'fileName' is not assigned and could be declared final.
Raw output
A method argument that is never re-assigned within the method can be declared final. <pre> <code> public void foo1 (String param) { // do stuff with param never assigning it } public void foo2 (final String param) { // better, do stuff with param never assigning it } </code> </pre> <a href="https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#methodargumentcouldbefinal"> See PMD documentation. </a>
throws XMLStreamException {
var packageName = getValueOf(startElement, NAME);
var packageNode = root.findOrCreatePackageNode(packageName);
while (reader.hasNext()) {
XMLEvent event = reader.nextEvent();

if (event.isStartElement()) {
var nextElement = event.asStartElement();
if (CLASSES.equals(nextElement.getName())) {
readClasses(reader, packageNode, fileName);
}
}
else if (event.isEndElement()) {
var endElement = event.asEndElement();
if (PACKAGE.equals(endElement.getName())) {
return packageNode;
}
}
}
throw createEofException(fileName);
}

@CanIgnoreReturnValue
private Node readClasses(final XMLEventReader reader, final PackageNode packageNode, String fileName) throws XMLStreamException {

Check warning on line 146 in src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java

View check run for this annotation

ci.jenkins.io / PMD

MethodArgumentCouldBeFinal

NORMAL: Parameter 'fileName' is not assigned and could be declared final.
Raw output
A method argument that is never re-assigned within the method can be declared final. <pre> <code> public void foo1 (String param) { // do stuff with param never assigning it } public void foo2 (final String param) { // better, do stuff with param never assigning it } </code> </pre> <a href="https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#methodargumentcouldbefinal"> See PMD documentation. </a>
while (reader.hasNext()) {
var event = reader.nextEvent();
if (event.isStartElement()) {
var startElement = event.asStartElement();
if (CLASS.equals(startElement.getName())) {
readClass(reader, packageNode, startElement, fileName);
}
} else if (event.isEndElement()) {

Check warning on line 154 in src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java

View check run for this annotation

ci.jenkins.io / CheckStyle

RightCurlyCheck

NORMAL: '}' at column 13 should be alone on a line.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks the placement of right curly braces (<code>'}'</code>) for if-else, try-catch-finally blocks, while-loops, for-loops, method definitions, class definitions, constructor definitions, instance and static initialization blocks. The policy to verify is specified using the property <code> option</code>. For right curly brace of expression blocks please follow issue <a href="https://github.com/checkstyle/checkstyle/issues/5945">#5945</a>. </p>
var endElement = event.asEndElement();
if (CLASSES.equals(endElement.getName())) {
return packageNode;
}
}
}
throw createEofException(fileName);
}

@CanIgnoreReturnValue
private ClassNode readClass(final XMLEventReader reader, final PackageNode packageNode, final StartElement startElement, String fileName) throws XMLStreamException {

Check warning on line 165 in src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java

View check run for this annotation

ci.jenkins.io / PMD

MethodArgumentCouldBeFinal

NORMAL: Parameter 'fileName' is not assigned and could be declared final.
Raw output
A method argument that is never re-assigned within the method can be declared final. <pre> <code> public void foo1 (String param) { // do stuff with param never assigning it } public void foo2 (final String param) { // better, do stuff with param never assigning it } </code> </pre> <a href="https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#methodargumentcouldbefinal"> See PMD documentation. </a>
String className = getValueOf(startElement, NAME);
String filePath = getValueOf(startElement, FILENAME);
if (!filePath.contains("/")) {
filePath = "./" + filePath; // Workaround for Nodes needing unique names where ClassName=FileName, and prepending the current working dir to filepath if file is located in current dir
}
FileNode fileNode = packageNode.findOrCreateFileNode(className, TreeString.valueOf(filePath));
ClassNode classNode = fileNode.findOrCreateClassNode(className);
while (reader.hasNext()) {
XMLEvent event = reader.nextEvent();
if (event.isStartElement()) {
var e = event.asStartElement();
// TODO methods(?) seems to be empty block

Check warning on line 177 in src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java

View check run for this annotation

ci.jenkins.io / Open Tasks Scanner

TODO

NORMAL: methods(?) seems to be empty block
if (LINES.equals(e.getName())) {
readLines(reader, fileNode, fileName);
} else {

Check warning on line 180 in src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java

View check run for this annotation

ci.jenkins.io / CheckStyle

RightCurlyCheck

NORMAL: '}' at column 17 should be alone on a line.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks the placement of right curly braces (<code>'}'</code>) for if-else, try-catch-finally blocks, while-loops, for-loops, method definitions, class definitions, constructor definitions, instance and static initialization blocks. The policy to verify is specified using the property <code> option</code>. For right curly brace of expression blocks please follow issue <a href="https://github.com/checkstyle/checkstyle/issues/5945">#5945</a>. </p>
LOGGER.warning("Unexpected element in <class> block: " + e.getName());

Check warning on line 181 in src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java

View check run for this annotation

ci.jenkins.io / SpotBugs

CRLF_INJECTION_LOGS

LOW: This use of java/util/logging/Logger.warning(Ljava/lang/String;)V might be used to include CRLF characters into log messages
Raw output
<p> When data from an untrusted source is put into a logger and not neutralized correctly, an attacker could forge log entries or include malicious content. Inserted false entries could be used to skew statistics, distract the administrator or even to implicate another party in the commission of a malicious act. If the log file is processed automatically, the attacker can render the file unusable by corrupting the format of the file or injecting unexpected characters. An attacker may also inject code or other commands into the log file and take advantage of a vulnerability in the log processing utility (e.g. command injection or XSS). </p> <br/> <p> <b>Code at risk:</b><br/> <pre>String val = request.getParameter("user"); String metadata = request.getParameter("metadata"); [...] if(authenticated) { log.info("User " + val + " (" + metadata + ") was authenticated successfully"); } else { log.info("User " + val + " (" + metadata + ") was not authenticated"); } </pre> A malicious user could send the metadata parameter with the value: <code>"Firefox) was authenticated successfully\r\n[INFO] User bbb (Internet Explorer"</code>. </p> <b>Solution:</b><br/> <p> You can manually sanitize each parameter. <pre> log.info("User " + val.replaceAll("[\r\n]","") + " (" + userAgent.replaceAll("[\r\n]","") + ") was not authenticated"); </pre> </p> <p> You can also configure your logger service to replace new line for all message events. Here is sample configuration for LogBack <a href="https://logback.qos.ch/manual/layouts.html#replace">using the <code>replace</code> function</a>. <pre> &lt;pattern&gt;%-5level - %replace(%msg){'[\r\n]', ''}%n&lt;/pattern&gt; </pre> </p> <p> Finally, you can use a logger implementation that replace new line by spaces. The project <a href="https://github.com/javabeanz/owasp-security-logging">OWASP Security Logging</a> has an implementation for Logback and Log4j. </p> <br/> <p> <b>References</b><br/> <a href="https://cwe.mitre.org/data/definitions/117.html">CWE-117: Improper Output Neutralization for Logs</a><br/> <a href="https://cwe.mitre.org/data/definitions/93.html">CWE-93: Improper Neutralization of CRLF Sequences ('CRLF Injection')</a><br/> <a href="https://logback.qos.ch/manual/layouts.html#replace">CWE-93: Improper Neutralization of CRLF Sequences ('CRLF Injection')</a><br/> <a href="https://github.com/javabeanz/owasp-security-logging">OWASP Security Logging</a><br/> </p>
}
} else if (event.isEndElement()) {

Check warning on line 183 in src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java

View check run for this annotation

ci.jenkins.io / CheckStyle

RightCurlyCheck

NORMAL: '}' at column 13 should be alone on a line.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks the placement of right curly braces (<code>'}'</code>) for if-else, try-catch-finally blocks, while-loops, for-loops, method definitions, class definitions, constructor definitions, instance and static initialization blocks. The policy to verify is specified using the property <code> option</code>. For right curly brace of expression blocks please follow issue <a href="https://github.com/checkstyle/checkstyle/issues/5945">#5945</a>. </p>
var endElement = event.asEndElement();
if (CLASS.equals(endElement.getName())) {
resolveLines(fileNode);
return classNode;
}
}
}
throw createEofException(fileName);
}

@CanIgnoreReturnValue
private Node readLines(final XMLEventReader reader, final FileNode fileNode, String fileName) throws XMLStreamException {

Check warning on line 195 in src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java

View check run for this annotation

ci.jenkins.io / PMD

MethodArgumentCouldBeFinal

NORMAL: Parameter 'fileName' is not assigned and could be declared final.
Raw output
A method argument that is never re-assigned within the method can be declared final. <pre> <code> public void foo1 (String param) { // do stuff with param never assigning it } public void foo2 (final String param) { // better, do stuff with param never assigning it } </code> </pre> <a href="https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#methodargumentcouldbefinal"> See PMD documentation. </a>
while (reader.hasNext()) {
XMLEvent event = reader.nextEvent();
if (event.isStartElement()) {
var nextElement = event.asStartElement();
if (LINE.equals(nextElement.getName())) {
readLine(fileNode, nextElement);
}
} else if (event.isEndElement()) {

Check warning on line 203 in src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java

View check run for this annotation

ci.jenkins.io / CheckStyle

RightCurlyCheck

NORMAL: '}' at column 13 should be alone on a line.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks the placement of right curly braces (<code>'}'</code>) for if-else, try-catch-finally blocks, while-loops, for-loops, method definitions, class definitions, constructor definitions, instance and static initialization blocks. The policy to verify is specified using the property <code> option</code>. For right curly brace of expression blocks please follow issue <a href="https://github.com/checkstyle/checkstyle/issues/5945">#5945</a>. </p>
var endElement = event.asEndElement();
if (LINES.equals(endElement.getName())) {
return fileNode;
}
}
}
throw createEofException(fileName);
}

private void readLine(final FileNode fileNode, StartElement element) {

Check warning on line 213 in src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java

View check run for this annotation

ci.jenkins.io / PMD

MethodArgumentCouldBeFinal

NORMAL: Parameter 'element' is not assigned and could be declared final.
Raw output
A method argument that is never re-assigned within the method can be declared final. <pre> <code> public void foo1 (String param) { // do stuff with param never assigning it } public void foo2 (final String param) { // better, do stuff with param never assigning it } </code> </pre> <a href="https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#methodargumentcouldbefinal"> See PMD documentation. </a>
int lineNumber = getIntegerValueOf(element, NUMBER);
int hits = getIntegerValueOf(element, HITS);
if (hits > 0) {
fileNode.addCounters(lineNumber, hits, 0);
} else {

Check warning on line 218 in src/main/java/edu/hm/hafner/coverage/parser/PythonParser.java

View check run for this annotation

ci.jenkins.io / CheckStyle

RightCurlyCheck

NORMAL: '}' at column 9 should be alone on a line.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks the placement of right curly braces (<code>'}'</code>) for if-else, try-catch-finally blocks, while-loops, for-loops, method definitions, class definitions, constructor definitions, instance and static initialization blocks. The policy to verify is specified using the property <code> option</code>. For right curly brace of expression blocks please follow issue <a href="https://github.com/checkstyle/checkstyle/issues/5945">#5945</a>. </p>
fileNode.addCounters(lineNumber, 0, 1);
}
}

private void resolveLines(final FileNode fileNode) {
var val = createValue("LINE", fileNode.getCoveredLines().size(), fileNode.getMissedLines().size());
fileNode.addValue(val);
for (ClassNode c: fileNode.getAllClassNodes()) {
c.addValue(val);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
package edu.hm.hafner.coverage.registry;

import edu.hm.hafner.coverage.parser.*;
import org.apache.commons.lang3.StringUtils;

import edu.hm.hafner.coverage.CoverageParser;
import edu.hm.hafner.coverage.CoverageParser.ProcessingMode;
import edu.hm.hafner.coverage.parser.CoberturaParser;
import edu.hm.hafner.coverage.parser.JacocoParser;
import edu.hm.hafner.coverage.parser.JunitParser;
import edu.hm.hafner.coverage.parser.NunitParser;
import edu.hm.hafner.coverage.parser.OpenCoverParser;
import edu.hm.hafner.coverage.parser.PitestParser;
import edu.hm.hafner.coverage.parser.XunitParser;

/**
* Provides a registry for all available {@link CoverageParserType parsers}.
Expand All @@ -26,7 +20,8 @@
JACOCO,
PIT,
JUNIT,
XUNIT
XUNIT,
PYTHON
}

/**
Expand Down Expand Up @@ -58,7 +53,7 @@
*
* @return the created parser
*/
public CoverageParser get(final CoverageParserType parser, final ProcessingMode processingMode) {

Check warning on line 56 in src/main/java/edu/hm/hafner/coverage/registry/ParserRegistry.java

View check run for this annotation

ci.jenkins.io / PMD

CyclomaticComplexity

NORMAL: The method 'get(CoverageParserType, ProcessingMode)' has a cyclomatic complexity of 10.
Raw output
The complexity of methods directly affects maintenance costs and readability. Concentrating too much decisional logic in a single method makes its behaviour hard to read and change. Cyclomatic complexity assesses the complexity of a method by counting the number of decision points in a method, plus one for the method entry. Decision points are places where the control flow jumps to another place in the program. As such, they include all control flow statements, such as `if`, `while`, `for`, and `case`. For more details on the calculation, see the documentation {% jdoc java::lang.java.metrics.JavaMetrics#CYCLO %}. Generally, numbers ranging from 1-4 denote low complexity, 5-7 denote moderate complexity, 8-10 denote high complexity, and 11+ is very high complexity. By default, this rule reports methods with a complexity >= 10. Additionally, classes with many methods of moderate complexity get reported as well once the total of their methods' complexities reaches 80, even if none of the methods was directly reported. Reported methods should be broken down into several smaller methods. Reported classes should probably be broken down into subcomponents. <pre> <code> class Foo { void baseCyclo() { // Cyclo = 1 highCyclo(); } void highCyclo() { // Cyclo = 10: reported! int x = 0, y = 2; boolean a = false, b = true; if (a &amp;&amp; (y == 1 ? b : true)) { // +3 if (y == x) { // +1 while (true) { // +1 if (x++ &lt; 20) { // +1 break; // +1 } } } else if (y == t &amp;&amp; !d) { // +2 x = a ? y : x; // +1 } else { x = 2; } } } } </code> </pre> <a href="https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#cyclomaticcomplexity"> See PMD documentation. </a>
switch (parser) {
case COBERTURA:
return new CoberturaParser(processingMode);
Expand All @@ -74,6 +69,8 @@
return new JunitParser(processingMode);
case XUNIT:
return new XunitParser(processingMode);
case PYTHON:
return new PythonParser(processingMode);
}
throw new IllegalArgumentException("Unknown parser type: " + parser);
}
Expand Down
66 changes: 66 additions & 0 deletions src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package edu.hm.hafner.coverage.parser;

import edu.hm.hafner.coverage.CoverageParser;
import edu.hm.hafner.coverage.FileNode;
import edu.hm.hafner.coverage.assertions.Assertions;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

Check warning on line 8 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / PMD

UnnecessaryImport

NORMAL: Unused static import 'org.junit.jupiter.api.Assertions.assertEquals'.
Raw output
Reports import statements that can be removed. They are either unused, duplicated, or the members they import are already implicitly in scope, because they're in java.lang, or the current package. <pre> <code> import java.io.File; // not used, can be removed import java.util.Collections; // used below import java.util.*; // so this one is not used import java.lang.Object; // imports from java.lang, unnecessary import java.lang.Object; // duplicate, unnecessary public class Foo { static Object emptyList() { return Collections.emptyList(); } } </code> </pre> <a href="https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryimport"> See PMD documentation. </a>

class PythonParserTest extends AbstractParserTest {

Check warning on line 10 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

RegexpMultilineCheck

NORMAL: No empty lines after opening curly braces allowed
Raw output
<p>Since Checkstyle 5.0</p><p> A check for detecting that matches across multiple lines. Works with any file type. </p><p> Rationale: This check can be used to when the regular expression can be span multiple lines. </p>


@Override

Check warning on line 13 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

EmptyLineSeparatorCheck

NORMAL: 'METHOD_DEF' has more than 1 empty lines before.
Raw output
<p>Since Checkstyle 5.8</p><p> Checks for empty line separators after header, package, all import declarations, fields, constructors, methods, nested classes, static initializers and instance initializers. </p><p> ATTENTION: empty line separator is required between AST siblings, not after line where token is found. </p>
protected String getFolder() {
return "python";
}

@Override
PythonParser createParser(CoverageParser.ProcessingMode processingMode) {

Check warning on line 19 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / PMD

MethodArgumentCouldBeFinal

NORMAL: Parameter 'processingMode' is not assigned and could be declared final.
Raw output
A method argument that is never re-assigned within the method can be declared final. <pre> <code> public void foo1 (String param) { // do stuff with param never assigning it } public void foo2 (final String param) { // better, do stuff with param never assigning it } </code> </pre> <a href="https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#methodargumentcouldbefinal"> See PMD documentation. </a>
return new PythonParser(processingMode);
}

@Test
void testBasic() throws Exception {
var root = readReport("coverage.xml");
for (FileNode f: root.getAllFileNodes()) {
switch (f.getRelativePath()) {
case "src/__init__.py":
Assertions.assertThat(f).hasMissedLines(8).hasCoveredLines(1,2,4,5,7,10,12,13,14,16);

Check warning on line 29 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 29 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 29 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 29 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 29 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 29 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 29 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 29 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 29 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>
break;
case "src/file1.py":
Assertions.assertThat(f).hasMissedLines(12,13,17,18,19,20,21,22,23,25,29)

Check warning on line 32 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 32 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 32 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 32 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 32 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 32 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 32 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 32 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 32 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 32 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>
.hasCoveredLines(1,2,3,4,5,7,10,11,15);

Check warning on line 33 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 33 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 33 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 33 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 33 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 33 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 33 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 33 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>
break;
case "src/dir/__init__.py":
Assertions.assertThat(f).hasMissedLines().hasCoveredLines();
break;
case "src/dir/file2.py":
Assertions.assertThat(f)
.hasMissedLines(26,27,28,29,30,31,36,37,38,39,40,42,43,45,53,54,65,66,68,69,70,72,73,77,80,82,86,87,88,90,91,92,93,94,95,96,97)

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 40 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>
.hasCoveredLines(1,2,3,4,5,6,7,8,10,13,14,33,84,85);

Check warning on line 41 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 41 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 41 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 41 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 41 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 41 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 41 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 41 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 41 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 41 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 41 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 41 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 41 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>
break;
default:
throw new Exception("Unexpected file: " + f.getRelativePath());

Check warning on line 44 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / PMD

AvoidThrowingRawExceptionTypes

HIGH: Avoid throwing raw exception types.
Raw output
Avoid throwing certain exception types. Rather than throw a raw RuntimeException, Throwable, Exception, or Error, use a subclassed exception or error instead. <pre> <code> public class Foo { public void bar() throws Exception { throw new Exception(); } } </code> </pre> <a href="https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#avoidthrowingrawexceptiontypes"> See PMD documentation. </a>
}
}
}

@Test
void testWorkspace() throws Exception {
var root = readReport("coverage-2.xml");
for (FileNode f: root.getAllFileNodes()) {
switch (f.getRelativePath()) {
case "./__init__.py":
Assertions.assertThat(f).hasMissedLines().hasCoveredLines();
break;
case "./components.py":
Assertions.assertThat(f).hasMissedLines()
.hasCoveredLines(1,3,6,15,18);

Check warning on line 59 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 59 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 59 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>

Check warning on line 59 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

WhitespaceAfterCheck

NORMAL: ',' is not followed by whitespace.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks that a token is followed by whitespace. </p>
break;
default:
throw new Exception("Unexpected file: " + f.getRelativePath());

Check warning on line 62 in src/test/java/edu/hm/hafner/coverage/parser/PythonParserTest.java

View check run for this annotation

ci.jenkins.io / PMD

AvoidThrowingRawExceptionTypes

HIGH: Avoid throwing raw exception types.
Raw output
Avoid throwing certain exception types. Rather than throw a raw RuntimeException, Throwable, Exception, or Error, use a subclassed exception or error instead. <pre> <code> public class Foo { public void bar() throws Exception { throw new Exception(); } } </code> </pre> <a href="https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#avoidthrowingrawexceptiontypes"> See PMD documentation. </a>
}
}
}
}
Loading
Loading