Skip to content

Commit

Permalink
Fix CheckStyle warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
arthur-devialet committed Jul 31, 2023
1 parent 960a03a commit 75bca56
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
package edu.hm.hafner.analysis.parser;


import java.io.UncheckedIOException;
import java.util.Iterator;
import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Stream;
import org.apache.commons.lang3.StringUtils;

import edu.hm.hafner.analysis.Issue;
import edu.hm.hafner.analysis.IssueBuilder;
import edu.hm.hafner.analysis.IssueParser;

Check warning on line 8 in src/main/java/edu/hm/hafner/analysis/parser/CrossCoreEmbeddedStudioParser.java

View check run for this annotation

ci.jenkins.io / PMD

UnnecessaryImport

NORMAL: Unused import 'edu.hm.hafner.analysis.IssueParser'.
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.analysis.LookaheadParser;
import edu.hm.hafner.analysis.ParsingException;
import edu.hm.hafner.analysis.ReaderFactory;
import edu.hm.hafner.analysis.Report;
import edu.hm.hafner.analysis.Severity;
import edu.hm.hafner.util.LookaheadStream;

Expand All @@ -34,13 +25,16 @@ public class CrossCoreEmbeddedStudioParser extends LookaheadParser {
* - Errors are not parsed, only warnings
*/
private static final String CCES_WARNING_PATTERN =
"^\"(.+?)\", line (\\d+).*(cc\\d+).*warning:(.*)";
"^\"(.+?)\", line (\\d+).*(cc\\d+).*warning:(.*)";

private static final Integer MATCHER_FILE = 1;
private static final Integer MATCHER_LINE = 2;
private static final Integer MATCHER_CATEGORY = 3;
private static final Integer MATCHER_MESSAGE_BEGIN = 4;

/**
* Creates a new instance of {@link CrossCoreEmbeddedStudioParser}.
*/
public CrossCoreEmbeddedStudioParser() {
super(CCES_WARNING_PATTERN);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import edu.hm.hafner.analysis.parser.CrossCoreEmbeddedStudioParser;

/**
* A descriptor for CrossCore Embedded Studio from Analog Devices
* A descriptor for CrossCore Embedded Studio from Analog Devices.
*/
public class CrossCoreEmbeddedStudioDescriptor extends ParserDescriptor {
private static final String ID = "crosscore-embedded-studio";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ protected void assertThatIssuesArePresent(final Report report, final SoftAsserti
// check all warnings were caught
softly.assertThat(report).hasSize(6);


// test in details the first warning
softly.assertThat(report.get(0))
.hasFileName("src/dummy_1.c")
Expand All @@ -34,11 +33,10 @@ protected void assertThatIssuesArePresent(final Report report, final SoftAsserti

// test in details the last warning, that has column (but not parsed)
softly.assertThat(report.get(5))
.hasFileName("src/dummy_5.c")
.hasLineStart(125)
.hasSeverity(Severity.WARNING_NORMAL)
.hasCategory("cc1462")
.hasMessage("call to dummy_btc has not been inlined");

.hasFileName("src/dummy_5.c")
.hasLineStart(125)
.hasSeverity(Severity.WARNING_NORMAL)
.hasCategory("cc1462")
.hasMessage("call to dummy_btc has not been inlined");
}
}

0 comments on commit 75bca56

Please sign in to comment.