Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
tofuatjava authored Jan 3, 2021
2 parents c5b687b + e1aeb67 commit afbd64d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<spotbugs.parser.library.version>6.0.4</spotbugs.parser.library.version>
<j2html.version>1.4.0</j2html.version>
<slf4j.version>1.7.30</slf4j.version>
<violations-lib.version>1.140</violations-lib.version>
<violations-lib.version>1.141</violations-lib.version>
<json.version>20201115</json.version>

<argLine>-Djava.util.logging.config.file=logging.properties</argLine>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.junit.jupiter.api.Test;

import edu.hm.hafner.analysis.AbstractParserTest;
import edu.hm.hafner.analysis.Issue;
import edu.hm.hafner.analysis.LineRange;
import edu.hm.hafner.analysis.LineRangeList;
import edu.hm.hafner.analysis.Report;
Expand Down Expand Up @@ -64,7 +65,11 @@ protected void assertThatIssuesArePresent(final Report report, final SoftAsserti
.hasSeverity(Severity.WARNING_HIGH);
}

/** Verifies that the parser finds multiple locations (line ranges) for a given warning. */
/**
* Verifies that the parser finds multiple locations (line ranges) for a given warning.
*
* @see <a href="https://issues.jenkins-ci.org/browse/JENKINS-55733">Issue 55733</a>
*/
@Test
void shouldFindMultipleLocations() {
Report report = parse("issue55733.xml");
Expand All @@ -86,7 +91,11 @@ void shouldFindMultipleLocations() {
assertThat(report.get(1).getLineRanges()).isEqualTo(new LineRangeList(new LineRange(335)));
}

/** Verifies that the parser finds multiple locations (line ranges) for a given warning with the same error ID. */
/**
* Verifies that the parser finds multiple locations (line ranges) for a given warning with the same error ID.
*
* @see <a href="https://issues.jenkins-ci.org/browse/JENKINS-55733">Issue 55733</a>
*/
@Test
void shouldFindMultipleLocationsWithSameId() {
Report report = parse("issue55733-multiple-tags-with-same-id.xml");
Expand All @@ -108,6 +117,22 @@ void shouldFindMultipleLocationsWithSameId() {
assertThat(report.get(1).getLineRanges()).isEqualTo(new LineRangeList(new LineRange(51)));
}

/**
* Verifies that the parser finds errors without location.
*
* @see <a href="https://issues.jenkins-ci.org/browse/JENKINS-64519">Issue 64519</a>
*/
@Test
void shouldFindErrorWithoutLocation() {
Report report = parse("issue64519.xml");

assertThat(report).hasSize(1);
Issue issue = report.get(0);

assertThat(issue).hasFileName("-")
.hasMessage("Cppcheck cannot find all the include files (use --check-config for details). Cppcheck cannot find all the include files. Cppcheck can check the code without the include files found. But the results will probably be more accurate if all the include files are found. Please check your project's include directories and add all of them as include directories for Cppcheck. To see what files Cppcheck cannot find use --check-config.");
}

@Override
protected CppCheckAdapter createParser() {
return new CppCheckAdapter();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<results version="2">
<cppcheck version="1.82"/>
<errors>
<error id="missingInclude" severity="information"
msg="Cppcheck cannot find all the include files (use --check-config for details)"
verbose="Cppcheck cannot find all the include files. Cppcheck can check the code without the include files found. But the results will probably be more accurate if all the include files are found. Please check your project's include directories and add all of them as include directories for Cppcheck. To see what files Cppcheck cannot find use --check-config."/>
</errors>
</results>

0 comments on commit afbd64d

Please sign in to comment.