Skip to content

Commit

Permalink
Merge pull request #986 from jenkinsci/dependabot/maven/edu.hm.hafner…
Browse files Browse the repository at this point in the history
…-codingstyle-pom-3.40.0

Bump edu.hm.hafner:codingstyle-pom from 3.39.0 to 3.40.0
  • Loading branch information
uhafner authored Dec 13, 2023
2 parents 8d52e2e + fa4e7c7 commit 3ebcbe2
Show file tree
Hide file tree
Showing 54 changed files with 10 additions and 97 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
[![Warnings](https://raw.githubusercontent.com/jenkinsci/analysis-model/main/badges/warnings.svg)](https://github.com/jenkinsci/analysis-model/actions/workflows/reporting.yml)

This library provides a Java object model to read, aggregate, filter, and query static analysis reports.
It is used by [Jenkins' warnings next generation plug-in](https://github.com/jenkinsci/warnings-ng-plugin) to visualize
It is used by [Jenkins' warnings plug-in](https://github.com/jenkinsci/warnings-ng-plugin) to visualize
the warnings of individual builds. Additionally, this library is used by a
[GitHub action](https://github.com/uhafner/autograding-github-action) to autograde student software projects based
[GitHub action](https://github.com/uhafner/autograding-github-action) and [GitLab action](https://github.com/uhafner/autograding-gitlab-action) to autograde student software projects based
on a given set of metrics (unit tests, code and mutation coverage, static analysis warnings).

This library consists basically of three separate parts:
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>edu.hm.hafner</groupId>
<artifactId>codingstyle-pom</artifactId>
<version>3.39.0</version>
<version>3.40.0</version>
<relativePath />
</parent>

Expand Down
2 changes: 0 additions & 2 deletions src/main/java/edu/hm/hafner/analysis/Issue.java
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,6 @@ public static Predicate<Issue> byType(final String type) {
@CheckForNull final String reference, @CheckForNull final String fingerprint,
@CheckForNull final Serializable additionalProperties,
final UUID id) {

this.pathName = normalizeFileName(pathName);
this.fileName = fileName;

Expand Down Expand Up @@ -934,5 +933,4 @@ public int hashCode() {
public String toString() {
return String.format("%s(%d,%d): %s: %s: %s", getBaseName(), lineStart, columnStart, type, category, message);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
* @author Bastian Kersting
*/
class KotlinPackageDetector extends AbstractPackageDetector {

private static final Pattern PACKAGE_PATTERN = Pattern.compile(
"^\\s*package\\s*([a-z]+[.\\w]*)\\s*.*");

Expand Down
2 changes: 0 additions & 2 deletions src/main/java/edu/hm/hafner/analysis/Report.java
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,6 @@ private void writeObject(final ObjectOutputStream output) throws IOException {
for (Report subReport : subReports) {
output.writeObject(subReport);
}

}

private void writeIssues(final ObjectOutputStream output) throws IOException {
Expand Down Expand Up @@ -1274,7 +1273,6 @@ enum FilterType {
*/
private void addNewFilter(final Collection<String> patterns, final Function<Issue, String> propertyToFilter,
final FilterType type) {

Collection<Predicate<Issue>> filters = new ArrayList<>();

Check warning on line 1276 in src/main/java/edu/hm/hafner/analysis/Report.java

View workflow job for this annotation

GitHub Actions / Autograding results

Error Prone: PreferredInterfaceType

Variable type can use a more specific type to convey more information to callers.
for (String pattern : patterns) {
filters.add(issueToFilter -> Pattern.compile(pattern, Pattern.DOTALL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ protected boolean isLineInteresting(final String line) {
@Override
protected Optional<Issue> createIssue(final Matcher matcher, final LookaheadStream lookahead,
final IssueBuilder builder) {

final String cat;

/* Ansible-lint has changed the style of parseable output. This requires
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,4 @@ private String formatDescription(final String fileName, final JSONObject resourc
div(b("Aqua Severity: "), text(severity)),
p(text(description))).render();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ protected Optional<Issue> createIssue(final Matcher matcher, final LookaheadStre
return builder.setFileName(matcher.group(2)).setLineStart(matcher.group(4))
.setCategory(guessCategory(matcher.group(5))).setMessage(matcher.group(5))
.setSeverity(priority).buildOptional();

}
}

Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ protected Optional<Issue> createIssue(final Matcher matcher, final LookaheadStre
}

private Severity getSeverity(final String severityText) {

if (severityText.contains("CRITICAL")) {
return Severity.ERROR;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public CrossCoreEmbeddedStudioParser() {
@Override
protected Optional<Issue> createIssue(final Matcher matcher, final LookaheadStream lookahead,
final IssueBuilder builder) {

StringBuilder message = new StringBuilder(matcher.group("messageBegin").trim());

// always grab the second line
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@ public class DoxygenParser extends Gcc4CompilerParser {
public DoxygenParser() {
super(DOXYGEN_WARNING_PATTERN);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -183,5 +183,4 @@ private String extractCategoryId(final Element problem) {
// XPath is "./@categoryID"
return problem.getAttribute("categoryID");
}

}
1 change: 0 additions & 1 deletion src/main/java/edu/hm/hafner/analysis/parser/GccParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,5 @@ else if (StringUtils.isNotBlank(matcher.group(4))) {
.setSeverity(priority)
.buildOptional();
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ static class JSLintXmlSaxParser extends DefaultHandler {
@Override
public void startElement(final String namespaceURI,
final String localName, final String key, final Attributes atts) {

if (isLintDerivate(key)) {
return; // Start element, good to skip
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,4 @@ private void clearBuilder(final IssueBuilder builder) {
protected boolean isLineInteresting(final String line) {
return line.startsWith("# ** ") || line.startsWith("** ");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public NagFortranParser() {
protected Optional<Issue> createIssue(final Matcher matcher, final LookaheadStream lookahead,
final IssueBuilder builder)
throws ParsingException {

StringBuilder messageBuilder = new StringBuilder(matcher.group(5));

while (lookahead.hasNext("\\s+ .+")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
* @author Fabian Kaupp - [email protected]
*/
public class PnpmAuditParser extends JsonIssueParser {

private static final String VALUE_NOT_SET = "-";
private static final String UNCATEGORIZED = "Uncategorized";

Expand Down Expand Up @@ -158,4 +157,4 @@ private Optional<ContainerTag> getValueAsContainerTag(final JSONObject vulnerabi

return Optional.of(div(b(label + ": "), text(value)));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,5 @@ private String getDescription(final JSONObject jsonIssue) {
jsonIssue.getString("description"),
jsonIssue.getString("name"),
jsonIssue.getString("code")) + severityDescription;

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,5 @@ else if (SEVERITY_MINOR.equals(severity) || SEVERITY_INFO.equals(severity)) {
}
return priority;
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,4 @@ private String class2package(final String clazz) {
int idx = clazz.lastIndexOf('.');
return idx > 0 ? clazz.substring(0, idx) : null;

Check warning on line 77 in src/main/java/edu/hm/hafner/analysis/parser/TaglistParser.java

View workflow job for this annotation

GitHub Actions / Autograding results

Partially covered line

Line 77 is only partially covered, one branch is missing
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import edu.hm.hafner.analysis.Severity;

import static j2html.TagCreator.*;
import static org.apache.commons.lang3.StringUtils.startsWith;
import static org.apache.commons.lang3.StringUtils.endsWith;

/**
* Parser for Veracode Pipeline Scanner (pipeline-scan) tool.
Expand Down Expand Up @@ -76,10 +74,10 @@ private Issue convertToIssue(final JSONObject finding, final IssueBuilder issueB
* @return original file name or a java file name prepended with src/main/java
*/
private String getEnrichedFileName(final String rawFileName) {
if (endsWith(rawFileName, ".java") && !startsWith(rawFileName, "src/main/java/")) {
if (StringUtils.endsWith(rawFileName, ".java") && !StringUtils.startsWith(rawFileName, "src/main/java/")) {
return "src/main/java/" + rawFileName;
}
else if (endsWith(rawFileName, ".kt") && !startsWith(rawFileName, "src/main/kotlin/")) {
else if (StringUtils.endsWith(rawFileName, ".kt") && !StringUtils.startsWith(rawFileName, "src/main/kotlin/")) {

Check warning on line 80 in src/main/java/edu/hm/hafner/analysis/parser/VeraCodePipelineScannerParser.java

View workflow job for this annotation

GitHub Actions / Autograding results

Partially covered line

Line 80 is only partially covered, one branch is missing

Check warning on line 80 in src/main/java/edu/hm/hafner/analysis/parser/VeraCodePipelineScannerParser.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 80 is only partially covered, one branch is missing
return "src/main/kotlin/" + rawFileName;
}
else {
Expand Down Expand Up @@ -144,7 +142,6 @@ else if (severity >= VERACODE_HIGH_THRESHOLD) {
else {
return Severity.WARNING_NORMAL;
}

}

private String formatDescription(final String fileName, final JSONObject finding) {
Expand All @@ -158,5 +155,4 @@ private String formatDescription(final String fileName, final JSONObject finding
div(b("Severity: "), text(severity)),
p(rawHtml(displayHtml))).render();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ protected Optional<Issue> createIssue(final Matcher matcher, final LookaheadStre

return builder.setFileName("unknown.file").setLineStart(0).setCategory(categoryAndPriority.getCategory())
.setMessage(message).setSeverity(categoryAndPriority.getPriority()).buildOptional();

}

@SuppressWarnings("npathcomplexity")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,4 @@ private String extractNodeContent(final Element subsection) throws TransformerEx

return StringUtils.replace(endSourceRemoved, "<source>", "<pre><code>");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public Report parse(final ReaderFactory factory) throws ParsingException {

private Report parseViolations(final List<Element> ruleElements, final Map<String, GendarmeRule> rules) {
try (IssueBuilder issueBuilder = new IssueBuilder()) {

Report warnings = new Report();
for (Element ruleElement : ruleElements) {
String ruleName = ruleElement.getAttribute("Name");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*/
@SuppressWarnings("PMD.DataClass")
public class Item {

@CheckForNull
private String column;
@CheckForNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*/

class CodeGeneratorDescriptor extends ParserDescriptor {

private static final String ID = "code-generator";
private static final String NAME = "Code Generator Tool";

Expand All @@ -27,4 +26,4 @@ public IssueParser createParser(final Option... options) {
public String getUrl() {
return "https://www.mathworks.com/help/stats/code-generation.html";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,4 @@ public String getUrl() {
public String getIconUrl() {
return "https://user-images.githubusercontent.com/5199289/136855393-d0a9eef9-ccf1-4e2b-9d7c-7aad16a567e5.png";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,4 @@ public String getUrl() {
public String getIconUrl() {
return "https://raw.githubusercontent.com/jeremylong/DependencyCheck/main/src/site/resources/images/logo.svg";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
* @author Fabian Kaupp - [email protected]
*/
class PnpmAuditDescriptor extends ParserDescriptor {

private static final String ID = "pnpm-audit";
private static final String NAME = "pnpm Audit";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*/

class SimulinkCheckDescriptor extends ParserDescriptor {

private static final String ID = "simulink-check-parser";
private static final String NAME = "Simulink Check Tool";

Expand Down
1 change: 0 additions & 1 deletion src/test/java/edu/hm/hafner/analysis/IssueBuilderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class IssueBuilderTest {
@Test
void shouldCreateAbsolutePath() {
try (IssueBuilder builder = new IssueBuilder()) {

builder.setFileName(RELATIVE_FILE);

assertThat(builder.build())
Expand Down
13 changes: 0 additions & 13 deletions src/test/java/edu/hm/hafner/analysis/ReportPrinterTest.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* Tests the class {@link AquaScannerParser}.
*/
class AquaScannerParserTest extends AbstractParserTest {

private static final String EXPECTED_FILENAME = "/opt/app/app-runner.jar:org/jose4j/json/JsonHeaderUtil.class";

AquaScannerParserTest() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ protected Armcc5CompilerParserTest() {

@Override
protected void assertThatIssuesArePresent(final Report report, final SoftAssertions softly) {

softly.assertThat(report).hasSize(3);

softly.assertThat(report.get(0)).hasSeverity(Severity.WARNING_HIGH)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
* @author Andreas Mandel
*/
class ClairParserTest extends AbstractParserTest {

ClairParserTest() {
super("clair.json");
}
Expand Down Expand Up @@ -77,4 +76,4 @@ void brokenInput() {
assertThatThrownBy(() -> parse("eclipse.txt"))
.isInstanceOf(ParsingException.class);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
* Tests the class {@link CodeAnalysisParser}.
*/
class CodeAnalysisParserTest extends AbstractParserTest {

/**
* Creates a new CodeAnalysisParserTest.
*/
CodeAnalysisParserTest() {
super("codeanalysis.txt");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import static edu.hm.hafner.analysis.assertions.Assertions.*;

class CodeCheckerParserTest extends AbstractParserTest {

CodeCheckerParserTest() {
super("CodeChecker_with_linux_paths.txt");
}
Expand Down Expand Up @@ -63,7 +62,6 @@ protected void assertThatIssuesArePresent(final Report report, final SoftAsserti
.hasMessage("misra violation (use --rule-texts=<file> to get proper output)")
.hasCategory("cppcheck-misra-c2012-11.3")
.hasSeverity(Severity.WARNING_LOW);

}

@Test
Expand Down Expand Up @@ -109,6 +107,5 @@ void shouldParseWindowsPaths() {
.hasMessage("suspicious usage of 'sizeof(A*)'; pointer to aggregate")
.hasCategory("bugprone-sizeof-expression")
.hasSeverity(Severity.WARNING_HIGH);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
* Tests the class {@link CoolfluxChessccParserTest}.
*/
class CoolfluxChessccParserTest extends AbstractParserTest {

/**
* Creates a new CoolfluxChessccParserTest.
*/
CoolfluxChessccParserTest() {
super("coolfluxchesscc.txt");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
* @author Andreas Mandel
*/
class DockerLintParserTest extends AbstractParserTest {

DockerLintParserTest() {
super("dockerlint.json");
}
Expand Down Expand Up @@ -62,4 +61,4 @@ void accepts() {
assertThat(new DockerLintParser().accepts(
new FileReaderFactory(FileSystems.getDefault().getPath("foo.txt")))).isFalse();
}
}
}
Loading

0 comments on commit 3ebcbe2

Please sign in to comment.