Skip to content

Commit

Permalink
Add support for Opencover format based on opencover plugin
Browse files Browse the repository at this point in the history
Signed-off-by: Valentin Delaye <jonesbusy@gmail.com>
  • Loading branch information
jonesbusy committed Dec 22, 2023
1 parent c704e7e commit 48d120d
Show file tree
Hide file tree
Showing 7 changed files with 7,954 additions and 0 deletions.
168 changes: 168 additions & 0 deletions src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
package edu.hm.hafner.coverage.parser;

import java.io.Reader;
import java.nio.file.Paths;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.UUID;

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 edu.hm.hafner.coverage.CoverageParser;
import edu.hm.hafner.coverage.FileNode;
import edu.hm.hafner.coverage.ModuleNode;
import edu.hm.hafner.coverage.Node;
import edu.hm.hafner.coverage.PackageNode;
import edu.hm.hafner.util.FilteredLog;
import edu.hm.hafner.util.PathUtil;
import edu.hm.hafner.util.SecureXmlParserFactory;
import edu.hm.hafner.util.SecureXmlParserFactory.ParsingException;

/**
* A parser which parses reports made by OpenCover into a Java Object Model.
*
*/
public class OpenCoverParser extends CoverageParser {

Check warning on line 30 in src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.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>

private static final long serialVersionUID = 1L;

private static final PathUtil PATH_UTIL = new PathUtil();

/** XML elements. */
private static final QName MODULE = new QName("Module");
private static final QName CLASS = new QName("Class");
private static final QName METHOD = new QName("Method");

Check warning on line 39 in src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.java

View check run for this annotation

ci.jenkins.io / PMD

UnusedPrivateField

NORMAL: Avoid unused private fields such as 'METHOD'.
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://pmd.github.io/pmd-6.55.0/pmd_rules_java_bestpractices.html#unusedprivatefield"> See PMD documentation. </a>
private static final QName CLASS_NAME = new QName("FullName");
private static final QName METHOD_NAME = new QName("Name");

Check warning on line 41 in src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.java

View check run for this annotation

ci.jenkins.io / PMD

UnusedPrivateField

NORMAL: Avoid unused private fields such as 'METHOD_NAME'.
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://pmd.github.io/pmd-6.55.0/pmd_rules_java_bestpractices.html#unusedprivatefield"> See PMD documentation. </a>
private static final QName MODULE_NAME = new QName("ModuleName");
private static final QName FILE = new QName("File");

private static final QName UID = new QName("uid");
private static final QName FULL_PATH = new QName("fullPath");
private static final QName CLASS_COMPLEXITY = new QName("maxCyclomaticComplexity");

Check warning on line 47 in src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.java

View check run for this annotation

ci.jenkins.io / PMD

UnusedPrivateField

NORMAL: Avoid unused private fields such as 'CLASS_COMPLEXITY'.
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://pmd.github.io/pmd-6.55.0/pmd_rules_java_bestpractices.html#unusedprivatefield"> See PMD documentation. </a>
private static final QName METHOD_COMPLEXITY = new QName("cyclomaticComplexity");

Check warning on line 48 in src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.java

View check run for this annotation

ci.jenkins.io / PMD

UnusedPrivateField

NORMAL: Avoid unused private fields such as 'METHOD_COMPLEXITY'.
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://pmd.github.io/pmd-6.55.0/pmd_rules_java_bestpractices.html#unusedprivatefield"> See PMD documentation. </a>

@Override
protected ModuleNode parseReport(final Reader reader, final FilteredLog log) {
try {
var eventReader = new SecureXmlParserFactory().createXmlEventReader(reader);
var root = new ModuleNode("-");
boolean isEmpty = true;
while (eventReader.hasNext()) {
XMLEvent event = eventReader.nextEvent();
if (event.isStartElement()) {
var startElement = event.asStartElement();
var tagName = startElement.getName();
if (MODULE.equals(tagName)) {
readPackage(eventReader, root, startElement, log);
isEmpty = false;
}
}
}
if (isEmpty) {
throw new NoSuchElementException("No coverage information found in the specified file.");
}
return root;
}
catch (XMLStreamException exception) {
throw new ParsingException(exception);
}
}

private void readPackage(final XMLEventReader reader, final ModuleNode root,
final StartElement currentStartElement, final FilteredLog log) throws XMLStreamException {

Check notice

Code scanning / CodeQL

Useless parameter Note

The parameter 'currentStartElement' is never used.

Check warning on line 78 in src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.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>

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

View check run for this annotation

ci.jenkins.io / PMD

UnusedFormalParameter

NORMAL: Avoid unused method parameters such as 'currentStartElement'.
Raw output
Reports parameters of methods and constructors that are not referenced them in the method body. Parameters whose name starts with `ignored` or `unused` are filtered out. Removing unused formal parameters from public methods could cause a ripple effect through the code base. Hence, by default, this rule only considers private methods. To include non-private methods, set the `checkAll` property to `true`. <pre> <code> public class Foo { private void bar(String howdy) { // howdy is not used } } </code> </pre> <a href="https://pmd.github.io/pmd-6.55.0/pmd_rules_java_bestpractices.html#unusedformalparameter"> See PMD documentation. </a>

Map<String, String> files = new LinkedHashMap<>();
PackageNode packageNode = null;
while (reader.hasNext()) {
XMLEvent event = reader.nextEvent();
if (event.isStartElement()) {
var nextElement = event.asStartElement();
if (CLASS.equals(nextElement.getName())) {
readClass(reader, nextElement, log);

Check warning on line 87 in src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.java

View check run for this annotation

ci.jenkins.io / Mutation Coverage

Mutation survived

One mutation survived in line 87 (VoidMethodCallMutator)
Raw output
Survived mutations:
- removed call to edu/hm/hafner/coverage/parser/OpenCoverParser::readClass (org.pitest.mutationtest.engine.gregor.mutators.VoidMethodCallMutator)
}

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

View check run for this annotation

ci.jenkins.io / CPD

CPD

LOW: Found duplicated code.
Raw output
<pre><code>while (reader.hasNext()) { XMLEvent event &#61; reader.nextEvent(); if (event.isStartElement()) { var nextElement &#61; event.asStartElement(); if (CLASS.equals(nextElement.getName())) { readClass(reader, packageNode, packageName, nextElement);</code></pre>
else if (FILE.equals(nextElement.getName())) {

Check warning on line 89 in src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.java

View check run for this annotation

ci.jenkins.io / CPD

CPD

LOW: Found duplicated code.
Raw output
<pre><code>PackageNode packageNode &#61; null; while (reader.hasNext()) { XMLEvent event &#61; reader.nextEvent(); if (event.isStartElement()) { var nextElement &#61; event.asStartElement(); if (CLASS.equals(nextElement.getName())) { readClass(reader, nextElement, log); } else if (FILE.equals(nextElement.getName())) {<!-- --></code></pre>
var fileName = getValueOf(nextElement, FULL_PATH);
var uid = getValueOf(nextElement, UID);
var relativePath = PATH_UTIL.getRelativePath(fileName);
files.put(uid, relativePath);
}
else if (MODULE_NAME.equals(nextElement.getName())) {
String packageName = reader.nextEvent().asCharacters().getData();
packageNode = root.findOrCreatePackageNode(packageName);
}
}
}

// Creating all file nodes
for (var entry : files.entrySet()) {
packageNode.findOrCreateFileNode(getFileName(entry.getValue()), getTreeStringBuilder().intern(entry.getValue()));

Check warning

Code scanning / CodeQL

Dereferenced variable may be null Warning

Variable
packageNode
may be null at this access because of
this
assignment.
}

Check warning on line 105 in src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.java

View check run for this annotation

ci.jenkins.io / CheckStyle

RegexpMultilineCheck

NORMAL: No empty lines before closing 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>

}

private void readFile(final XMLEventReader reader, final ModuleNode root,
final StartElement currentStartElement, final FilteredLog log) throws XMLStreamException {

Check notice

Code scanning / CodeQL

Useless parameter Note

The parameter 'currentStartElement' is never used.

Check warning on line 110 in src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.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>

Check warning on line 110 in src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.java

View check run for this annotation

ci.jenkins.io / PMD

UnusedFormalParameter

NORMAL: Avoid unused method parameters such as 'currentStartElement'.
Raw output
Reports parameters of methods and constructors that are not referenced them in the method body. Parameters whose name starts with `ignored` or `unused` are filtered out. Removing unused formal parameters from public methods could cause a ripple effect through the code base. Hence, by default, this rule only considers private methods. To include non-private methods, set the `checkAll` property to `true`. <pre> <code> public class Foo { private void bar(String howdy) { // howdy is not used } } </code> </pre> <a href="https://pmd.github.io/pmd-6.55.0/pmd_rules_java_bestpractices.html#unusedformalparameter"> See PMD documentation. </a>

PackageNode packageNode = null;

Check notice

Code scanning / CodeQL

Unread local variable Note

Variable 'PackageNode packageNode' is never read.

Check warning on line 112 in src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.java

View check run for this annotation

ci.jenkins.io / PMD

UnusedLocalVariable

NORMAL: Avoid unused local variables such as 'packageNode'.
Raw output
Detects when a local variable is declared and/or assigned, but not used. Variables whose name starts with `ignored` or `unused` are filtered out. <pre> <code> public class Foo { public void doSomething() { int i = 5; // Unused } } </code> </pre> <a href="https://pmd.github.io/pmd-6.55.0/pmd_rules_java_bestpractices.html#unusedlocalvariable"> See PMD documentation. </a>

Check warning on line 112 in src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.java

View check run for this annotation

ci.jenkins.io / PMD

UnusedAssignment

NORMAL: The initializer for variable 'packageNode' is never used (overwritten on line 122).
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://pmd.github.io/pmd-6.55.0/pmd_rules_java_bestpractices.html#unusedassignment"> See PMD documentation. </a>
while (reader.hasNext()) {
XMLEvent event = reader.nextEvent();
if (event.isStartElement()) {
var nextElement = event.asStartElement();
if (CLASS.equals(nextElement.getName())) {
readClass(reader, nextElement, log);
}

Check warning on line 119 in src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.java

View check run for this annotation

ci.jenkins.io / CPD

CPD

LOW: Found duplicated code.
Raw output
<pre><code>while (reader.hasNext()) { XMLEvent event &#61; reader.nextEvent(); if (event.isStartElement()) { var nextElement &#61; event.asStartElement(); if (CLASS.equals(nextElement.getName())) { readClass(reader, packageNode, packageName, nextElement);</code></pre>
else if (MODULE_NAME.equals(nextElement.getName())) {

Check warning on line 120 in src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.java

View check run for this annotation

ci.jenkins.io / CPD

CPD

LOW: Found duplicated code.
Raw output
<pre><code>PackageNode packageNode &#61; null; while (reader.hasNext()) { XMLEvent event &#61; reader.nextEvent(); if (event.isStartElement()) { var nextElement &#61; event.asStartElement(); if (CLASS.equals(nextElement.getName())) { readClass(reader, nextElement, log); } else if (FILE.equals(nextElement.getName())) {<!-- --></code></pre>
String packageName = reader.nextEvent().asCharacters().getData();
packageNode = root.findOrCreatePackageNode(packageName);

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

View check run for this annotation

ci.jenkins.io / SpotBugs

DLS_DEAD_LOCAL_STORE

LOW: Dead store to packageNode in edu.hm.hafner.coverage.parser.OpenCoverParser.readFile(XMLEventReader, ModuleNode, StartElement, FilteredLog)
Raw output
<p> This instruction assigns a value to a local variable, but the value is not read or used in any subsequent instruction. Often, this indicates an error, because the value computed is never used. </p> <p> Note that Sun's javac compiler often generates dead stores for final local variables. Because SpotBugs is a bytecode-based tool, there is no easy way to eliminate these false positives. </p>

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

View check run for this annotation

ci.jenkins.io / PMD

UnusedAssignment

NORMAL: The value assigned to variable 'packageNode' is never used (reassigned every iteration).
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://pmd.github.io/pmd-6.55.0/pmd_rules_java_bestpractices.html#unusedassignment"> See PMD documentation. </a>
}
}
}
}

Check warning on line 126 in src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 112-126 are not covered by tests

Check warning on line 126 in src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.java

View check run for this annotation

ci.jenkins.io / SpotBugs

UPM_UNCALLED_PRIVATE_METHOD

LOW: Private method edu.hm.hafner.coverage.parser.OpenCoverParser.readFile(XMLEventReader, ModuleNode, StartElement, FilteredLog) is never called
Raw output
<p> This private method is never called. Although it is possible that the method will be invoked through reflection, it is more likely that the method is never used, and should be removed. </p>

private void readClass(final XMLEventReader reader, final StartElement parentElement, final FilteredLog log) throws XMLStreamException {

Check notice

Code scanning / CodeQL

Useless parameter Note

The parameter 'parentElement' is never used.

Check notice

Code scanning / CodeQL

Useless parameter Note

The parameter 'log' is never used.

Check warning on line 128 in src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.java

View check run for this annotation

ci.jenkins.io / PMD

UnusedFormalParameter

NORMAL: Avoid unused method parameters such as 'log'.
Raw output
Reports parameters of methods and constructors that are not referenced them in the method body. Parameters whose name starts with `ignored` or `unused` are filtered out. Removing unused formal parameters from public methods could cause a ripple effect through the code base. Hence, by default, this rule only considers private methods. To include non-private methods, set the `checkAll` property to `true`. <pre> <code> public class Foo { private void bar(String howdy) { // howdy is not used } } </code> </pre> <a href="https://pmd.github.io/pmd-6.55.0/pmd_rules_java_bestpractices.html#unusedformalparameter"> See PMD documentation. </a>

Check warning on line 128 in src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.java

View check run for this annotation

ci.jenkins.io / PMD

UnusedFormalParameter

NORMAL: Avoid unused method parameters such as 'parentElement'.
Raw output
Reports parameters of methods and constructors that are not referenced them in the method body. Parameters whose name starts with `ignored` or `unused` are filtered out. Removing unused formal parameters from public methods could cause a ripple effect through the code base. Hence, by default, this rule only considers private methods. To include non-private methods, set the `checkAll` property to `true`. <pre> <code> public class Foo { private void bar(String howdy) { // howdy is not used } } </code> </pre> <a href="https://pmd.github.io/pmd-6.55.0/pmd_rules_java_bestpractices.html#unusedformalparameter"> See PMD documentation. </a>
while (reader.hasNext()) {

Check warning on line 129 in src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.java

View check run for this annotation

ci.jenkins.io / Mutation Coverage

Mutation survived

One mutation survived in line 129 (NegateConditionalsMutator)
Raw output
Survived mutations:
- negated conditional (org.pitest.mutationtest.engine.gregor.mutators.NegateConditionalsMutator)
XMLEvent event = reader.nextEvent();
if (event.isStartElement()) {
var nextElement = event.asStartElement();
if (CLASS_NAME.equals(nextElement.getName())) {
String className = reader.nextEvent().asCharacters().getData();

Check notice

Code scanning / CodeQL

Unread local variable Note

Variable 'String className' is never read.

Check warning on line 134 in src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.java

View check run for this annotation

ci.jenkins.io / SpotBugs

DLS_DEAD_LOCAL_STORE

LOW: Dead store to $L6 in edu.hm.hafner.coverage.parser.OpenCoverParser.readClass(XMLEventReader, StartElement, FilteredLog)
Raw output
<p> This instruction assigns a value to a local variable, but the value is not read or used in any subsequent instruction. Often, this indicates an error, because the value computed is never used. </p> <p> Note that Sun's javac compiler often generates dead stores for final local variables. Because SpotBugs is a bytecode-based tool, there is no easy way to eliminate these false positives. </p>

Check warning on line 134 in src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.java

View check run for this annotation

ci.jenkins.io / PMD

UnusedLocalVariable

NORMAL: Avoid unused local variables such as 'className'.
Raw output
Detects when a local variable is declared and/or assigned, but not used. Variables whose name starts with `ignored` or `unused` are filtered out. <pre> <code> public class Foo { public void doSomething() { int i = 5; // Unused } } </code> </pre> <a href="https://pmd.github.io/pmd-6.55.0/pmd_rules_java_bestpractices.html#unusedlocalvariable"> See PMD documentation. </a>
}
}
}
}

private int readComplexity(final String c) {
try {
return Math.round(Float.parseFloat(c)); // some reports use float values
}
catch (NumberFormatException ignore) {
return 0;

Check warning on line 145 in src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.java

View check run for this annotation

ci.jenkins.io / SpotBugs

UPM_UNCALLED_PRIVATE_METHOD

LOW: Private method edu.hm.hafner.coverage.parser.OpenCoverParser.readComplexity(String) is never called
Raw output
<p> This private method is never called. Although it is possible that the method will be invoked through reflection, it is more likely that the method is never used, and should be removed. </p>
}
}

private Node createClassNode(final FileNode file, final StartElement parentElement) {

Check notice

Code scanning / CodeQL

Useless parameter Note

The parameter 'parentElement' is never used.

Check warning on line 149 in src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.java

View check run for this annotation

ci.jenkins.io / PMD

UnusedFormalParameter

NORMAL: Avoid unused method parameters such as 'parentElement'.
Raw output
Reports parameters of methods and constructors that are not referenced them in the method body. Parameters whose name starts with `ignored` or `unused` are filtered out. Removing unused formal parameters from public methods could cause a ripple effect through the code base. Hence, by default, this rule only considers private methods. To include non-private methods, set the `checkAll` property to `true`. <pre> <code> public class Foo { private void bar(String howdy) { // howdy is not used } } </code> </pre> <a href="https://pmd.github.io/pmd-6.55.0/pmd_rules_java_bestpractices.html#unusedformalparameter"> See PMD documentation. </a>
// Read summary has name
return file.createClassNode(UUID.randomUUID().toString());

Check warning on line 151 in src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 142-151 are not covered by tests

Check warning on line 151 in src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.java

View check run for this annotation

ci.jenkins.io / SpotBugs

UPM_UNCALLED_PRIVATE_METHOD

LOW: Private method edu.hm.hafner.coverage.parser.OpenCoverParser.createClassNode(FileNode, StartElement) is never called
Raw output
<p> This private method is never called. Although it is possible that the method will be invoked through reflection, it is more likely that the method is never used, and should be removed. </p>
}

protected static String getValueOf(final StartElement element, final QName attribute) {
return getOptionalValueOf(element, attribute).orElseThrow(
() -> new NoSuchElementException(String.format(

Check warning on line 156 in src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 156 is not covered by tests
"Could not obtain attribute '%s' from element '%s'", attribute, element)));
}

private String getFileName(final String relativePath) {
var path = Paths.get(PATH_UTIL.getAbsolutePath(relativePath)).getFileName();
if (path == null) {

Check warning on line 162 in src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 162 is only partially covered, one branch is missing
return relativePath;

Check warning on line 163 in src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 163 is not covered by tests
}
return path.toString();
}

Check warning on line 166 in src/main/java/edu/hm/hafner/coverage/parser/OpenCoverParser.java

View check run for this annotation

ci.jenkins.io / CheckStyle

RegexpMultilineCheck

NORMAL: No empty lines before closing 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>

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
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.OpenCoverParser;
import edu.hm.hafner.coverage.parser.PitestParser;

/**
Expand All @@ -18,6 +19,7 @@ public class ParserRegistry {
/** Supported parsers. */
public enum CoverageParserType {
COBERTURA,
OPENCOVER,
JACOCO,
PIT,
JUNIT
Expand Down Expand Up @@ -56,6 +58,8 @@ public CoverageParser get(final CoverageParserType parser, final ProcessingMode
switch (parser) {
case COBERTURA:
return new CoberturaParser(processingMode);
case OPENCOVER:
return new OpenCoverParser();
case JACOCO:
return new JacocoParser();
case PIT:
Expand Down
158 changes: 158 additions & 0 deletions src/test/java/edu/hm/hafner/coverage/parser/OpenCoverParserTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
package edu.hm.hafner.coverage.parser;


import org.apache.commons.lang3.StringUtils;

Check warning on line 4 in src/test/java/edu/hm/hafner/coverage/parser/OpenCoverParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

EmptyLineSeparatorCheck

NORMAL: 'import' 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 4 in src/test/java/edu/hm/hafner/coverage/parser/OpenCoverParserTest.java

View check run for this annotation

ci.jenkins.io / PMD

UnnecessaryImport

NORMAL: Unused import 'org.apache.commons.lang3.StringUtils'.
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://pmd.github.io/pmd-6.55.0/pmd_rules_java_codestyle.html#unnecessaryimport"> See PMD documentation. </a>
import org.junit.jupiter.api.Test;
import org.junitpioneer.jupiter.DefaultLocale;

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

Check warning on line 10 in src/test/java/edu/hm/hafner/coverage/parser/OpenCoverParserTest.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://pmd.github.io/pmd-6.55.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 12 in src/test/java/edu/hm/hafner/coverage/parser/OpenCoverParserTest.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://pmd.github.io/pmd-6.55.0/pmd_rules_java_codestyle.html#unnecessaryimport"> See PMD documentation. </a>
import edu.hm.hafner.coverage.FileNode;
import edu.hm.hafner.coverage.LinesOfCode;

Check warning on line 14 in src/test/java/edu/hm/hafner/coverage/parser/OpenCoverParserTest.java

View check run for this annotation

ci.jenkins.io / PMD

UnnecessaryImport

NORMAL: Unused import 'edu.hm.hafner.coverage.LinesOfCode'.
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://pmd.github.io/pmd-6.55.0/pmd_rules_java_codestyle.html#unnecessaryimport"> See PMD documentation. </a>
import edu.hm.hafner.coverage.Metric;
import edu.hm.hafner.coverage.ModuleNode;
import edu.hm.hafner.coverage.Node;
import edu.hm.hafner.coverage.PackageNode;
import edu.hm.hafner.coverage.Percentage;

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

View check run for this annotation

ci.jenkins.io / PMD

UnnecessaryImport

NORMAL: Unused import 'edu.hm.hafner.coverage.Percentage'.
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://pmd.github.io/pmd-6.55.0/pmd_rules_java_codestyle.html#unnecessaryimport"> See PMD documentation. </a>

import static edu.hm.hafner.coverage.Metric.CLASS;

Check warning on line 21 in src/test/java/edu/hm/hafner/coverage/parser/OpenCoverParserTest.java

View check run for this annotation

ci.jenkins.io / PMD

UnnecessaryImport

NORMAL: Unused import 'edu.hm.hafner.coverage.Metric.CLASS'.
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://pmd.github.io/pmd-6.55.0/pmd_rules_java_codestyle.html#unnecessaryimport"> See PMD documentation. </a>
import static edu.hm.hafner.coverage.Metric.FILE;
import static edu.hm.hafner.coverage.Metric.*;
import static edu.hm.hafner.coverage.assertions.Assertions.*;

import java.util.List;
import java.util.stream.Collectors;

Check warning on line 27 in src/test/java/edu/hm/hafner/coverage/parser/OpenCoverParserTest.java

View check run for this annotation

ci.jenkins.io / PMD

UnnecessaryImport

NORMAL: Unused import 'java.util.stream.Collectors'.
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://pmd.github.io/pmd-6.55.0/pmd_rules_java_codestyle.html#unnecessaryimport"> See PMD documentation. </a>


@DefaultLocale("en")

Check warning on line 30 in src/test/java/edu/hm/hafner/coverage/parser/OpenCoverParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

EmptyLineSeparatorCheck

NORMAL: 'CLASS_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>
class OpenCoverParserTest extends AbstractParserTest {

Check warning on line 31 in src/test/java/edu/hm/hafner/coverage/parser/OpenCoverParserTest.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>

private static final String PROJECT_NAME = "Java coding style";
private static final String EMPTY = "-";

@Override
CoverageParser createParser() {
return new OpenCoverParser();
}

@Test
void shouldReadReport() {
readExampleReport();
}

@Test
void shouldCreatePackageName() {
ModuleNode tree = readExampleReport();

String fileName = "MyLogging.FancyClass.cs";
assertThat(tree.find(FILE, fileName)).isNotEmpty()
.hasValueSatisfying(node -> assertThat(node).hasName(fileName)
.hasParentName("MyLogging")
.hasParent()
.isNotRoot());

tree.splitPackages();
assertThat(tree.find(FILE, fileName)).isNotEmpty()
.hasValueSatisfying(node -> assertThat(node).hasName(fileName)
.hasParentName("MyLogging")
.hasParent()
.isNotRoot());
}

@Test
void shouldSplitPackages() {
ModuleNode tree = readExampleReport();

tree.splitPackages();

verifyCoverageMetrics(tree);

assertThat(tree.getAll(PACKAGE)).hasSize(1);

// TODO: Assertions

Check warning on line 75 in src/test/java/edu/hm/hafner/coverage/parser/OpenCoverParserTest.java

View check run for this annotation

ci.jenkins.io / Open Tasks Scanner

TODO

NORMAL: Assertions
}

@Test
void shouldFilterByFiles() {
var root = readExampleReport();

assertThat(root.getAll(MODULE)).hasSize(1);

Check warning on line 82 in src/test/java/edu/hm/hafner/coverage/parser/OpenCoverParserTest.java

View check run for this annotation

ci.jenkins.io / CPD

CPD

LOW: Found duplicated code.
Raw output
<pre><code>assertThat(log.getPartiallyCoveredLines()).containsExactly(entry(113, 1)); } &#64;Test void shouldFilterByFiles() { var root &#61; readExampleReport(); assertThat(root.getAll(MODULE)).hasSize(1); assertThat(root.getAll(PACKAGE)).hasSize(1); assertThat(root.getAll(FILE)).hasSize(10);</code></pre>
assertThat(root.getAll(PACKAGE)).hasSize(1);
assertThat(root.getAll(FILE)).hasSize(3);

// TODO: Not yet implemented on parser

Check warning on line 86 in src/test/java/edu/hm/hafner/coverage/parser/OpenCoverParserTest.java

View check run for this annotation

ci.jenkins.io / Open Tasks Scanner

TODO

NORMAL: Not yet implemented on parser
//assertThat(root.getAll(CLASS)).hasSize(18);
//assertThat(root.getAll(METHOD)).hasSize(102);

// TODO: Assertions

Check warning on line 90 in src/test/java/edu/hm/hafner/coverage/parser/OpenCoverParserTest.java

View check run for this annotation

ci.jenkins.io / Open Tasks Scanner

TODO

NORMAL: Assertions
}

private void verifyCoverageMetrics(final Node tree) {
List<Node> nodes = tree.getAll(FILE);

long missedInstructions = 0;
long coveredInstructions = 0;
long missedBranches = 0;
long coveredBranches = 0;
long missedLines = 0;
long coveredLines = 0;
for (Node node : nodes) {
var instructionCoverage = (Coverage) node.getValue(INSTRUCTION).orElse(Coverage.nullObject(INSTRUCTION));
missedInstructions = missedInstructions + instructionCoverage.getMissed();
coveredInstructions = coveredInstructions + instructionCoverage.getCovered();
var branchCoverage = (Coverage) node.getValue(BRANCH).orElse(Coverage.nullObject(BRANCH));

Check warning on line 106 in src/test/java/edu/hm/hafner/coverage/parser/OpenCoverParserTest.java

View check run for this annotation

ci.jenkins.io / CPD

CPD

LOW: Found duplicated code.
Raw output
<pre><code>.isNotRoot()); } private void verifyCoverageMetrics(final Node tree) { List&lt;Node&gt; nodes &#61; tree.getAll(FILE); long missedInstructions &#61; 0; long coveredInstructions &#61; 0; long missedBranches &#61; 0; long coveredBranches &#61; 0; long missedLines &#61; 0; long coveredLines &#61; 0; for (Node node : nodes) { var instructionCoverage &#61; (Coverage) node.getValue(INSTRUCTION).orElse(Coverage.nullObject(INSTRUCTION)); missedInstructions &#61; missedInstructions &#43; instructionCoverage.getMissed(); coveredInstructions &#61; coveredInstructions &#43; instructionCoverage.getCovered(); var branchCoverage &#61; (Coverage) node.getValue(BRANCH).orElse(Coverage.nullObject(BRANCH)); missedBranches &#61; missedBranches &#43; branchCoverage.getMissed(); coveredBranches &#61; coveredBranches &#43; branchCoverage.getCovered(); var lineCoverage &#61; (Coverage) node.getValue(LINE).orElse(Coverage.nullObject(LINE)); missedLines &#61; missedLines &#43; lineCoverage.getMissed(); coveredLines &#61; coveredLines &#43; lineCoverage.getCovered(); }</code></pre>
missedBranches = missedBranches + branchCoverage.getMissed();
coveredBranches = coveredBranches + branchCoverage.getCovered();
var lineCoverage = (Coverage) node.getValue(LINE).orElse(Coverage.nullObject(LINE));
missedLines = missedLines + lineCoverage.getMissed();
coveredLines = coveredLines + lineCoverage.getCovered();
}

// TODO: Assertions

Check warning on line 114 in src/test/java/edu/hm/hafner/coverage/parser/OpenCoverParserTest.java

View check run for this annotation

ci.jenkins.io / Open Tasks Scanner

TODO

NORMAL: Assertions
}

private PackageNode getPackage(final Node node) {
var children = node.getChildren();
assertThat(children).hasSize(1).first().isInstanceOf(PackageNode.class);

return (PackageNode) children.get(0);
}

private ClassNode getFirstClass(final Node node) {
var packageNode = getPackage(node);

var children = packageNode.getChildren();
assertThat(children).isNotEmpty().first().isInstanceOf(ClassNode.class);

return (ClassNode) children.get(0);

Check warning on line 130 in src/test/java/edu/hm/hafner/coverage/parser/OpenCoverParserTest.java

View check run for this annotation

ci.jenkins.io / SpotBugs

UPM_UNCALLED_PRIVATE_METHOD

LOW: Private method edu.hm.hafner.coverage.parser.OpenCoverParserTest.getFirstClass(Node) is never called
Raw output
<p> This private method is never called. Although it is possible that the method will be invoked through reflection, it is more likely that the method is never used, and should be removed. </p>
}

private FileNode getFileNode(final ModuleNode a) {

Check warning on line 133 in src/test/java/edu/hm/hafner/coverage/parser/OpenCoverParserTest.java

View check run for this annotation

ci.jenkins.io / CPD

CPD

LOW: Found duplicated code.
Raw output
<pre><code>} private PackageNode getPackage(final Node node) { var children &#61; node.getChildren(); assertThat(children).hasSize(1).first().isInstanceOf(PackageNode.class); return (PackageNode) children.get(0); } private ClassNode getFirstClass(final Node node) { var packageNode &#61; getPackage(node); var children &#61; packageNode.getChildren(); assertThat(children).isNotEmpty().first().isInstanceOf(ClassNode.class); return (ClassNode) children.get(0); } private TestCase getFirstTest(final Node node) {<!-- --></code></pre>
var fileNodes = a.getAllFileNodes();
assertThat(fileNodes).hasSize(1);

var lineRange = fileNodes.get(0);
assertThat(lineRange)
.hasName("MyLogging.FancyClass.cs")
.hasRelativePath("opencovertests\\MyLogging.FancyClass.cs");

return lineRange;

Check warning on line 142 in src/test/java/edu/hm/hafner/coverage/parser/OpenCoverParserTest.java

View check run for this annotation

ci.jenkins.io / SpotBugs

UPM_UNCALLED_PRIVATE_METHOD

LOW: Private method edu.hm.hafner.coverage.parser.OpenCoverParserTest.getFileNode(ModuleNode) is never called
Raw output
<p> This private method is never called. Although it is possible that the method will be invoked through reflection, it is more likely that the method is never used, and should be removed. </p>
}

private static Coverage getCoverage(final Node node, final Metric metric) {
return (Coverage) node.getValue(metric).get();

Check warning on line 146 in src/test/java/edu/hm/hafner/coverage/parser/OpenCoverParserTest.java

View check run for this annotation

ci.jenkins.io / SpotBugs

UPM_UNCALLED_PRIVATE_METHOD

LOW: Private method edu.hm.hafner.coverage.parser.OpenCoverParserTest.getCoverage(Node, Metric) is never called
Raw output
<p> This private method is never called. Although it is possible that the method will be invoked through reflection, it is more likely that the method is never used, and should be removed. </p>
}

private ModuleNode readExampleReport() {
return readReport("opencover.xml", new OpenCoverParser());
}

@Override
protected String getFolder() {
return "opencover";
}

Check warning on line 156 in src/test/java/edu/hm/hafner/coverage/parser/OpenCoverParserTest.java

View check run for this annotation

ci.jenkins.io / CheckStyle

RegexpMultilineCheck

NORMAL: No empty lines before closing 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>

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import edu.hm.hafner.coverage.parser.JacocoParser;
import edu.hm.hafner.coverage.parser.JunitParser;
import edu.hm.hafner.coverage.parser.PitestParser;
import edu.hm.hafner.coverage.parser.OpenCoverParser;
import edu.hm.hafner.coverage.registry.ParserRegistry.CoverageParserType;

import static org.assertj.core.api.Assertions.*;
Expand All @@ -24,6 +25,9 @@ void shouldCreateSomeParsers() {
.isInstanceOf(PitestParser.class);
assertThat(registry.get(CoverageParserType.JUNIT, ProcessingMode.IGNORE_ERRORS))
.isInstanceOf(JunitParser.class);
assertThat(registry.get(CoverageParserType.COBERTURA.name(), ProcessingMode.FAIL_FAST)).isInstanceOf(CoberturaParser.class);
assertThat(registry.get(CoverageParserType.JACOCO, ProcessingMode.IGNORE_ERRORS)).isInstanceOf(JacocoParser.class);
assertThat(registry.get(CoverageParserType.OPENCOVER, ProcessingMode.IGNORE_ERRORS)).isInstanceOf(OpenCoverParser.class);
}

@Test

Check warning on line 33 in src/test/java/edu/hm/hafner/coverage/registry/ParserRegistryTest.java

View check run for this annotation

ci.jenkins.io / CPD

CPD

LOW: Found duplicated code.
Raw output
<pre><code>var registry &#61; new ParserRegistry(); assertThat(registry.get(CoverageParserType.COBERTURA.name(), ProcessingMode.FAIL_FAST)) .isInstanceOf(CoberturaParser.class); assertThat(registry.get(CoverageParserType.JACOCO, ProcessingMode.IGNORE_ERRORS)) .isInstanceOf(JacocoParser.class); assertThat(registry.get(CoverageParserType.PIT.name(), ProcessingMode.FAIL_FAST))</code></pre>
Expand Down
Loading

0 comments on commit 48d120d

Please sign in to comment.