diff --git a/src/main/java/edu/hm/hafner/analysis/AntModuleDetector.java b/src/main/java/edu/hm/hafner/analysis/AntModuleDetector.java index bec77c18d..24e495200 100644 --- a/src/main/java/edu/hm/hafner/analysis/AntModuleDetector.java +++ b/src/main/java/edu/hm/hafner/analysis/AntModuleDetector.java @@ -1,7 +1,6 @@ package edu.hm.hafner.analysis; import java.io.IOException; -import java.io.InputStream; import java.nio.file.InvalidPathException; import java.util.List; import java.util.Map; diff --git a/src/main/java/edu/hm/hafner/analysis/FileReaderFactory.java b/src/main/java/edu/hm/hafner/analysis/FileReaderFactory.java index a2569b26c..0b48b2105 100644 --- a/src/main/java/edu/hm/hafner/analysis/FileReaderFactory.java +++ b/src/main/java/edu/hm/hafner/analysis/FileReaderFactory.java @@ -11,7 +11,6 @@ import java.nio.file.Files; import java.nio.file.InvalidPathException; import java.nio.file.Path; -import javax.xml.stream.XMLStreamReader; import org.apache.commons.io.input.BOMInputStream; diff --git a/src/main/java/edu/hm/hafner/analysis/GradleModuleDetector.java b/src/main/java/edu/hm/hafner/analysis/GradleModuleDetector.java index 05303735e..b03fdf10b 100644 --- a/src/main/java/edu/hm/hafner/analysis/GradleModuleDetector.java +++ b/src/main/java/edu/hm/hafner/analysis/GradleModuleDetector.java @@ -1,7 +1,7 @@ package edu.hm.hafner.analysis; import java.io.IOException; -import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.nio.file.InvalidPathException; import java.util.List; import java.util.Map; @@ -76,7 +76,7 @@ private String parseGradleSettings(final String settingsFile) { String name = null; try (var input = getFactory().open(settingsFile); - var scan = new Scanner(input, "UTF-8")) { + var scan = new Scanner(input, StandardCharsets.UTF_8)) { while (scan.hasNextLine()) { var line = scan.findInLine(RE_GRADLE_SET_PROJECT_NAME); diff --git a/src/main/java/edu/hm/hafner/analysis/IssueBuilder.java b/src/main/java/edu/hm/hafner/analysis/IssueBuilder.java index bd6cf5c46..8d89bc97f 100644 --- a/src/main/java/edu/hm/hafner/analysis/IssueBuilder.java +++ b/src/main/java/edu/hm/hafner/analysis/IssueBuilder.java @@ -8,7 +8,6 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; -import edu.hm.hafner.util.LineRange; import edu.hm.hafner.util.LineRangeList; import edu.hm.hafner.util.PathUtil; import edu.hm.hafner.util.TreeString; diff --git a/src/main/java/edu/hm/hafner/analysis/MavenModuleDetector.java b/src/main/java/edu/hm/hafner/analysis/MavenModuleDetector.java index d96c191c4..d87b74353 100644 --- a/src/main/java/edu/hm/hafner/analysis/MavenModuleDetector.java +++ b/src/main/java/edu/hm/hafner/analysis/MavenModuleDetector.java @@ -1,7 +1,6 @@ package edu.hm.hafner.analysis; import java.io.IOException; -import java.io.InputStream; import java.nio.file.InvalidPathException; import java.util.List; import java.util.Map; diff --git a/src/main/java/edu/hm/hafner/analysis/OsgiModuleDetector.java b/src/main/java/edu/hm/hafner/analysis/OsgiModuleDetector.java index 3e803bc84..56644c68a 100644 --- a/src/main/java/edu/hm/hafner/analysis/OsgiModuleDetector.java +++ b/src/main/java/edu/hm/hafner/analysis/OsgiModuleDetector.java @@ -1,7 +1,6 @@ package edu.hm.hafner.analysis; import java.io.IOException; -import java.io.InputStream; import java.nio.file.InvalidPathException; import java.util.List; import java.util.Map; diff --git a/src/main/java/edu/hm/hafner/analysis/Report.java b/src/main/java/edu/hm/hafner/analysis/Report.java index f34981de2..957b6d418 100644 --- a/src/main/java/edu/hm/hafner/analysis/Report.java +++ b/src/main/java/edu/hm/hafner/analysis/Report.java @@ -38,7 +38,6 @@ import edu.hm.hafner.util.Generated; import edu.hm.hafner.util.LineRangeList; import edu.hm.hafner.util.PathUtil; -import edu.hm.hafner.util.TreeString; import edu.hm.hafner.util.TreeStringBuilder; import edu.hm.hafner.util.VisibleForTesting; import edu.umd.cs.findbugs.annotations.CheckForNull; diff --git a/src/main/java/edu/hm/hafner/analysis/Severity.java b/src/main/java/edu/hm/hafner/analysis/Severity.java index 5faa530dd..6e4ab1589 100644 --- a/src/main/java/edu/hm/hafner/analysis/Severity.java +++ b/src/main/java/edu/hm/hafner/analysis/Severity.java @@ -4,7 +4,6 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; -import java.util.LinkedHashSet; import java.util.List; import java.util.Objects; import java.util.Set; diff --git a/src/main/java/edu/hm/hafner/analysis/parser/AbstractMavenLogParser.java b/src/main/java/edu/hm/hafner/analysis/parser/AbstractMavenLogParser.java index 64d593134..ad658b1c0 100644 --- a/src/main/java/edu/hm/hafner/analysis/parser/AbstractMavenLogParser.java +++ b/src/main/java/edu/hm/hafner/analysis/parser/AbstractMavenLogParser.java @@ -1,7 +1,6 @@ package edu.hm.hafner.analysis.parser; import java.io.Serial; -import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.commons.lang3.StringUtils; diff --git a/src/main/java/edu/hm/hafner/analysis/parser/AquaScannerParser.java b/src/main/java/edu/hm/hafner/analysis/parser/AquaScannerParser.java index 1759c3271..829799ca8 100644 --- a/src/main/java/edu/hm/hafner/analysis/parser/AquaScannerParser.java +++ b/src/main/java/edu/hm/hafner/analysis/parser/AquaScannerParser.java @@ -37,12 +37,12 @@ protected void parseJsonObject(final Report report, final JSONObject jsonReport, private void parseResources(final Report report, final JSONArray resources, final IssueBuilder issueBuilder) { for (int i = 0; i < resources.length(); i++) { - final var item = resources.get(i); - if (item instanceof JSONObject resourceWrapper) { - if (!resourceWrapper.isNull("vulnerabilities") && !resourceWrapper.isNull("resource")) { - var resource = resourceWrapper.getJSONObject("resource"); - parseVulnerabilities(report, issueBuilder, resourceWrapper, resource); - } + var item = resources.get(i); + if (item instanceof JSONObject resourceWrapper + && !resourceWrapper.isNull("vulnerabilities") + && !resourceWrapper.isNull("resource")) { + var resource = resourceWrapper.getJSONObject("resource"); + parseVulnerabilities(report, issueBuilder, resourceWrapper, resource); } } } @@ -69,7 +69,8 @@ private Issue convertToIssue(final JSONObject resource, final JSONObject vulnera } private Severity mapSeverity(final String string) { - if (StringUtils.containsAnyIgnoreCase(string, AQUA_VULNERABILITY_LEVEL_TAG_LOW, AQUA_VULNERABILITY_LEVEL_TAG_NEGLIGIBLE)) { + if (StringUtils.containsAnyIgnoreCase(string, AQUA_VULNERABILITY_LEVEL_TAG_LOW, + AQUA_VULNERABILITY_LEVEL_TAG_NEGLIGIBLE)) { return Severity.WARNING_LOW; } else if (StringUtils.equalsIgnoreCase(string, AQUA_VULNERABILITY_LEVEL_TAG_MEDIUM)) { diff --git a/src/main/java/edu/hm/hafner/analysis/parser/BrakemanParser.java b/src/main/java/edu/hm/hafner/analysis/parser/BrakemanParser.java index 2ea13e4fd..2373d7fea 100644 --- a/src/main/java/edu/hm/hafner/analysis/parser/BrakemanParser.java +++ b/src/main/java/edu/hm/hafner/analysis/parser/BrakemanParser.java @@ -2,7 +2,6 @@ import java.io.Serial; -import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; diff --git a/src/main/java/edu/hm/hafner/analysis/parser/EmbeddedEngineerParser.java b/src/main/java/edu/hm/hafner/analysis/parser/EmbeddedEngineerParser.java index b6c4d7931..e8572c267 100644 --- a/src/main/java/edu/hm/hafner/analysis/parser/EmbeddedEngineerParser.java +++ b/src/main/java/edu/hm/hafner/analysis/parser/EmbeddedEngineerParser.java @@ -2,7 +2,6 @@ import java.io.Serial; import java.io.UncheckedIOException; -import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Stream; diff --git a/src/main/java/edu/hm/hafner/analysis/parser/FlowParser.java b/src/main/java/edu/hm/hafner/analysis/parser/FlowParser.java index cd2d144cb..7fc4abf5f 100644 --- a/src/main/java/edu/hm/hafner/analysis/parser/FlowParser.java +++ b/src/main/java/edu/hm/hafner/analysis/parser/FlowParser.java @@ -1,7 +1,6 @@ package edu.hm.hafner.analysis.parser; import java.io.IOException; -import java.io.Reader; import java.io.Serial; import java.util.Optional; @@ -49,7 +48,7 @@ public class FlowParser extends JsonIssueParser { public boolean accepts(final ReaderFactory readerFactory) { try (var reader = readerFactory.create()) { var value = new JSONTokener(reader).nextValue(); - return value instanceof JSONObject jsono && jsono.has(FLOW_VERSION); + return value instanceof final JSONObject jsono && jsono.has(FLOW_VERSION); } catch (IOException | JSONException ignored) { return false; @@ -66,7 +65,7 @@ protected void parseJsonObject(final Report report, final JSONObject jsonReport, private void extractIssues(final JSONArray elements, final Report report, final IssueBuilder issueBuilder) { for (Object object : elements) { - if (object instanceof JSONObject issue) { + if (object instanceof final JSONObject issue) { findFirstMessage(issue).ifPresent( jsonObject -> report.add(createIssueFromJsonObject(issue, jsonObject, issueBuilder))); } diff --git a/src/main/java/edu/hm/hafner/analysis/parser/GrypeParser.java b/src/main/java/edu/hm/hafner/analysis/parser/GrypeParser.java index 32ef8ca73..de82dbf77 100644 --- a/src/main/java/edu/hm/hafner/analysis/parser/GrypeParser.java +++ b/src/main/java/edu/hm/hafner/analysis/parser/GrypeParser.java @@ -2,7 +2,6 @@ import java.io.Serial; -import org.json.JSONArray; import org.json.JSONObject; import edu.hm.hafner.analysis.Issue; diff --git a/src/main/java/edu/hm/hafner/analysis/parser/IdeaInspectionParser.java b/src/main/java/edu/hm/hafner/analysis/parser/IdeaInspectionParser.java index 843bbaa6f..4b8353bad 100644 --- a/src/main/java/edu/hm/hafner/analysis/parser/IdeaInspectionParser.java +++ b/src/main/java/edu/hm/hafner/analysis/parser/IdeaInspectionParser.java @@ -5,9 +5,7 @@ import org.apache.commons.lang3.StringUtils; import org.apache.commons.text.StringEscapeUtils; -import org.w3c.dom.Document; import org.w3c.dom.Element; -import org.w3c.dom.Node; import edu.hm.hafner.analysis.IssueBuilder; import edu.hm.hafner.analysis.IssueParser; diff --git a/src/main/java/edu/hm/hafner/analysis/parser/JsonParser.java b/src/main/java/edu/hm/hafner/analysis/parser/JsonParser.java index a9fa71c8f..e617f91a8 100644 --- a/src/main/java/edu/hm/hafner/analysis/parser/JsonParser.java +++ b/src/main/java/edu/hm/hafner/analysis/parser/JsonParser.java @@ -1,12 +1,10 @@ package edu.hm.hafner.analysis.parser; import java.io.IOException; -import java.io.Reader; import java.io.Serial; import java.util.Optional; import java.util.stream.StreamSupport; -import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import org.json.JSONTokener; diff --git a/src/main/java/edu/hm/hafner/analysis/parser/OwaspDependencyCheckParser.java b/src/main/java/edu/hm/hafner/analysis/parser/OwaspDependencyCheckParser.java index e9ac60fe6..9c500017a 100644 --- a/src/main/java/edu/hm/hafner/analysis/parser/OwaspDependencyCheckParser.java +++ b/src/main/java/edu/hm/hafner/analysis/parser/OwaspDependencyCheckParser.java @@ -2,7 +2,6 @@ import java.io.Serial; -import org.json.JSONArray; import org.json.JSONObject; import edu.hm.hafner.analysis.Issue; diff --git a/src/main/java/edu/hm/hafner/analysis/parser/PnpmAuditParser.java b/src/main/java/edu/hm/hafner/analysis/parser/PnpmAuditParser.java index 2998ee882..d02626c85 100644 --- a/src/main/java/edu/hm/hafner/analysis/parser/PnpmAuditParser.java +++ b/src/main/java/edu/hm/hafner/analysis/parser/PnpmAuditParser.java @@ -5,7 +5,6 @@ import java.util.List; import java.util.Optional; -import org.json.JSONArray; import org.json.JSONObject; import edu.hm.hafner.analysis.Issue; diff --git a/src/main/java/edu/hm/hafner/analysis/parser/SimulinkCheckParser.java b/src/main/java/edu/hm/hafner/analysis/parser/SimulinkCheckParser.java index 7d092acd2..0877730ec 100644 --- a/src/main/java/edu/hm/hafner/analysis/parser/SimulinkCheckParser.java +++ b/src/main/java/edu/hm/hafner/analysis/parser/SimulinkCheckParser.java @@ -1,8 +1,6 @@ package edu.hm.hafner.analysis.parser; import java.io.IOException; -import java.io.InputStream; -import java.io.Reader; import java.io.Serial; import java.util.regex.Pattern; diff --git a/src/main/java/edu/hm/hafner/analysis/parser/SonarQubeParser.java b/src/main/java/edu/hm/hafner/analysis/parser/SonarQubeParser.java index 15281aca0..e6132cb5a 100644 --- a/src/main/java/edu/hm/hafner/analysis/parser/SonarQubeParser.java +++ b/src/main/java/edu/hm/hafner/analysis/parser/SonarQubeParser.java @@ -1,7 +1,6 @@ package edu.hm.hafner.analysis.parser; import java.io.IOException; -import java.io.Reader; import java.io.Serial; import org.json.JSONArray; @@ -94,10 +93,8 @@ protected void parseJsonObject(final Report report, final JSONObject jsonReport, private void extractIssues(final JSONArray elements, final Report report, final IssueBuilder issueBuilder) { for (Object object : elements) { - if (object instanceof JSONObject issue) { - if (filterIssue(issue)) { - report.add(createIssueFromJsonObject(issue, issueBuilder)); - } + if (object instanceof final JSONObject issue && filterIssue(issue)) { + report.add(createIssueFromJsonObject(issue, issueBuilder)); } } } @@ -231,8 +228,7 @@ private String parseMessage(final JSONObject issue) { * @return the priority. */ private Severity parsePriority(final JSONObject issue) { - var severity = issue.optString(ISSUE_SEVERITY, null); - return severityToPriority(severity); + return severityToPriority(issue.optString(ISSUE_SEVERITY, SEVERITY_MINOR)); } //UTILITIES @@ -271,10 +267,9 @@ String parseModulePath(final JSONObject moduleKeyObject, final String componentK private JSONObject findComponentByKey(final String key) { if (components != null && key != null) { for (Object component : components) { - if (component instanceof JSONObject jsonComponent) { - if (key.equals(jsonComponent.optString(COMPONENT_KEY))) { - return jsonComponent; - } + if (component instanceof final JSONObject jsonComponent + && key.equals(jsonComponent.optString(COMPONENT_KEY))) { + return jsonComponent; } } } @@ -298,16 +293,13 @@ private JSONObject findComponentByKey(final String key) { * @return a priority object corresponding to the passed severity. */ private Severity severityToPriority(final String severity) { - var priority = Severity.WARNING_NORMAL; // Severity MAJOR is omitted as it corresponds with default Severity: NORMAL - if (severity != null) { - if (SEVERITY_BLOCKER.equals(severity) || SEVERITY_CRITICAL.equals(severity)) { - priority = Severity.WARNING_HIGH; - } - else if (SEVERITY_MINOR.equals(severity) || SEVERITY_INFO.equals(severity)) { - priority = Severity.WARNING_LOW; - } + if (SEVERITY_BLOCKER.equals(severity) || SEVERITY_CRITICAL.equals(severity)) { + return Severity.WARNING_HIGH; + } + else if (SEVERITY_MINOR.equals(severity) || SEVERITY_INFO.equals(severity)) { + return Severity.WARNING_LOW; } - return priority; + return Severity.WARNING_NORMAL; } } diff --git a/src/main/java/edu/hm/hafner/analysis/parser/YoctoScannerParser.java b/src/main/java/edu/hm/hafner/analysis/parser/YoctoScannerParser.java index 903a7ffa8..fa63c07fd 100644 --- a/src/main/java/edu/hm/hafner/analysis/parser/YoctoScannerParser.java +++ b/src/main/java/edu/hm/hafner/analysis/parser/YoctoScannerParser.java @@ -33,18 +33,16 @@ protected void parseJsonObject(final Report report, final JSONObject jsonReport, private void parseResources(final Report report, final JSONArray packages, final IssueBuilder issueBuilder) { for (int i = 0; i < packages.length(); i++) { - final var item = packages.get(i); - if (item instanceof JSONObject resourceWrapper) { - if (!resourceWrapper.isNull("issue")) { - parseVulnerabilities(report, issueBuilder, resourceWrapper); - } + var item = packages.get(i); + if (item instanceof JSONObject resourceWrapper && !resourceWrapper.isNull("issue")) { + parseVulnerabilities(report, issueBuilder, resourceWrapper); } } } private void parseVulnerabilities(final Report report, final IssueBuilder issueBuilder, final JSONObject resourceWrapper) { - final var vulnerabilities = resourceWrapper.getJSONArray("issue"); + var vulnerabilities = resourceWrapper.getJSONArray("issue"); for (Object vulnerability : vulnerabilities) { if (vulnerability instanceof JSONObject obj) { var status = obj.getString("status"); @@ -70,12 +68,15 @@ private Issue convertToIssue(final JSONObject resource, final JSONObject vulnera } private Severity mapSeverity(final JSONObject vulnerability) { - var score = INVALID_SCORE; boolean hasScoreV3 = vulnerability.has("scorev3"); + double score; if (hasScoreV3) { score = vulnerability.getDouble("scorev3"); } + else { + score = INVALID_SCORE; + } if (score <= 0) { score = vulnerability.getDouble("scorev2"); @@ -94,7 +95,8 @@ else if (score >= 7.0 && score <= 10.0) { return Severity.ERROR; } - private String formatDescription(final String packageName, final JSONObject resource, final JSONObject vulnerability) { + private String formatDescription(final String packageName, final JSONObject resource, + final JSONObject vulnerability) { final var version = resource.optString("version", VALUE_NOT_SET); final var layer = resource.optString("layer", "UNKOWN"); final var vector = vulnerability.optString("vector", "UNKOWN"); diff --git a/src/main/java/edu/hm/hafner/analysis/parser/checkstyle/CheckStyleRules.java b/src/main/java/edu/hm/hafner/analysis/parser/checkstyle/CheckStyleRules.java index c2a7443b3..f833fff4e 100644 --- a/src/main/java/edu/hm/hafner/analysis/parser/checkstyle/CheckStyleRules.java +++ b/src/main/java/edu/hm/hafner/analysis/parser/checkstyle/CheckStyleRules.java @@ -1,7 +1,6 @@ package edu.hm.hafner.analysis.parser.checkstyle; import java.io.IOException; -import java.io.InputStream; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; diff --git a/src/main/java/edu/hm/hafner/analysis/parser/dry/AbstractDryParser.java b/src/main/java/edu/hm/hafner/analysis/parser/dry/AbstractDryParser.java index 278fc5ae9..28dc58211 100644 --- a/src/main/java/edu/hm/hafner/analysis/parser/dry/AbstractDryParser.java +++ b/src/main/java/edu/hm/hafner/analysis/parser/dry/AbstractDryParser.java @@ -1,7 +1,6 @@ package edu.hm.hafner.analysis.parser.dry; import java.io.IOException; -import java.io.Reader; import java.io.Serial; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/edu/hm/hafner/analysis/parser/dry/cpd/CpdParser.java b/src/main/java/edu/hm/hafner/analysis/parser/dry/cpd/CpdParser.java index b6b6ed001..6b86a7c06 100644 --- a/src/main/java/edu/hm/hafner/analysis/parser/dry/cpd/CpdParser.java +++ b/src/main/java/edu/hm/hafner/analysis/parser/dry/cpd/CpdParser.java @@ -6,7 +6,6 @@ import org.apache.commons.digester3.Digester; import edu.hm.hafner.analysis.DuplicationGroup; -import edu.hm.hafner.analysis.Issue; import edu.hm.hafner.analysis.IssueBuilder; import edu.hm.hafner.analysis.Report; import edu.hm.hafner.analysis.parser.dry.AbstractDryParser; diff --git a/src/main/java/edu/hm/hafner/analysis/parser/dry/dupfinder/DupFinderParser.java b/src/main/java/edu/hm/hafner/analysis/parser/dry/dupfinder/DupFinderParser.java index 3996740dc..b4efa5a1d 100644 --- a/src/main/java/edu/hm/hafner/analysis/parser/dry/dupfinder/DupFinderParser.java +++ b/src/main/java/edu/hm/hafner/analysis/parser/dry/dupfinder/DupFinderParser.java @@ -6,7 +6,6 @@ import org.apache.commons.digester3.Digester; import edu.hm.hafner.analysis.DuplicationGroup; -import edu.hm.hafner.analysis.Issue; import edu.hm.hafner.analysis.IssueBuilder; import edu.hm.hafner.analysis.Report; import edu.hm.hafner.analysis.parser.dry.AbstractDryParser; diff --git a/src/main/java/edu/hm/hafner/analysis/parser/dry/simian/SimianParser.java b/src/main/java/edu/hm/hafner/analysis/parser/dry/simian/SimianParser.java index d8ea9f843..e50741166 100644 --- a/src/main/java/edu/hm/hafner/analysis/parser/dry/simian/SimianParser.java +++ b/src/main/java/edu/hm/hafner/analysis/parser/dry/simian/SimianParser.java @@ -6,7 +6,6 @@ import org.apache.commons.digester3.Digester; import edu.hm.hafner.analysis.DuplicationGroup; -import edu.hm.hafner.analysis.Issue; import edu.hm.hafner.analysis.IssueBuilder; import edu.hm.hafner.analysis.Report; import edu.hm.hafner.analysis.parser.dry.AbstractDryParser; diff --git a/src/main/java/edu/hm/hafner/analysis/parser/findbugs/FindBugsParser.java b/src/main/java/edu/hm/hafner/analysis/parser/findbugs/FindBugsParser.java index c7648fd3e..297caa089 100644 --- a/src/main/java/edu/hm/hafner/analysis/parser/findbugs/FindBugsParser.java +++ b/src/main/java/edu/hm/hafner/analysis/parser/findbugs/FindBugsParser.java @@ -9,7 +9,6 @@ import java.util.List; import java.util.Map; -import org.apache.commons.digester3.Digester; import org.apache.commons.lang3.StringUtils; import org.dom4j.DocumentException; import org.xml.sax.SAXException; @@ -247,7 +246,7 @@ private void setAffectedLines(final BugInstance warning, final IssueBuilder buil var lineRanges = new LineRangeList(); while (annotationIterator.hasNext()) { var bugAnnotation = annotationIterator.next(); - if (bugAnnotation instanceof SourceLineAnnotation annotation) { + if (bugAnnotation instanceof final SourceLineAnnotation annotation) { var lineRange = new LineRange(annotation.getStartLine(), annotation.getEndLine()); if (!lineRanges.contains(lineRange) && !primary.equals(lineRange)) { lineRanges.add(lineRange); diff --git a/src/main/java/edu/hm/hafner/analysis/parser/gendarme/GendarmeParser.java b/src/main/java/edu/hm/hafner/analysis/parser/gendarme/GendarmeParser.java index 244c31f2e..50761662a 100644 --- a/src/main/java/edu/hm/hafner/analysis/parser/gendarme/GendarmeParser.java +++ b/src/main/java/edu/hm/hafner/analysis/parser/gendarme/GendarmeParser.java @@ -6,7 +6,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.commons.lang3.StringUtils; diff --git a/src/main/java/edu/hm/hafner/analysis/parser/jcreport/JcReportParser.java b/src/main/java/edu/hm/hafner/analysis/parser/jcreport/JcReportParser.java index eadbd38b4..9976ece9c 100644 --- a/src/main/java/edu/hm/hafner/analysis/parser/jcreport/JcReportParser.java +++ b/src/main/java/edu/hm/hafner/analysis/parser/jcreport/JcReportParser.java @@ -1,7 +1,6 @@ package edu.hm.hafner.analysis.parser.jcreport; import java.io.IOException; -import java.io.Reader; import java.io.Serial; import org.xml.sax.SAXException; diff --git a/src/main/java/edu/hm/hafner/analysis/parser/pylint/PyLintDescriptions.java b/src/main/java/edu/hm/hafner/analysis/parser/pylint/PyLintDescriptions.java index 667633483..94112abeb 100644 --- a/src/main/java/edu/hm/hafner/analysis/parser/pylint/PyLintDescriptions.java +++ b/src/main/java/edu/hm/hafner/analysis/parser/pylint/PyLintDescriptions.java @@ -1,7 +1,6 @@ package edu.hm.hafner.analysis.parser.pylint; import java.io.IOException; -import java.io.InputStream; import java.util.HashMap; import java.util.Map; diff --git a/src/main/java/edu/hm/hafner/analysis/parser/violations/DocFxAdapter.java b/src/main/java/edu/hm/hafner/analysis/parser/violations/DocFxAdapter.java index 118f913a2..39f62a0c4 100644 --- a/src/main/java/edu/hm/hafner/analysis/parser/violations/DocFxAdapter.java +++ b/src/main/java/edu/hm/hafner/analysis/parser/violations/DocFxAdapter.java @@ -2,11 +2,10 @@ import java.io.Serial; -import se.bjurr.violations.lib.model.SEVERITY; import se.bjurr.violations.lib.model.Violation; import se.bjurr.violations.lib.parsers.DocFXParser; -import static se.bjurr.violations.lib.model.SEVERITY.INFO; +import static se.bjurr.violations.lib.model.SEVERITY.*; /** * Parses DocFX files. diff --git a/src/test/java/edu/hm/hafner/analysis/AbstractBenchmark.java b/src/test/java/edu/hm/hafner/analysis/AbstractBenchmark.java index e0203cd01..f700c3c44 100644 --- a/src/test/java/edu/hm/hafner/analysis/AbstractBenchmark.java +++ b/src/test/java/edu/hm/hafner/analysis/AbstractBenchmark.java @@ -7,7 +7,6 @@ import org.openjdk.jmh.profile.StackProfiler; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; -import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; /** diff --git a/src/test/java/edu/hm/hafner/analysis/CSharpNamespaceDetectorTest.java b/src/test/java/edu/hm/hafner/analysis/CSharpNamespaceDetectorTest.java index 369970c85..e9434dc7b 100644 --- a/src/test/java/edu/hm/hafner/analysis/CSharpNamespaceDetectorTest.java +++ b/src/test/java/edu/hm/hafner/analysis/CSharpNamespaceDetectorTest.java @@ -1,7 +1,6 @@ package edu.hm.hafner.analysis; import java.io.IOException; -import java.io.InputStream; import java.nio.charset.StandardCharsets; import org.junit.jupiter.api.Test; diff --git a/src/test/java/edu/hm/hafner/analysis/GradleModuleDetectorTest.java b/src/test/java/edu/hm/hafner/analysis/GradleModuleDetectorTest.java index 0091eda0e..fa24d84db 100644 --- a/src/test/java/edu/hm/hafner/analysis/GradleModuleDetectorTest.java +++ b/src/test/java/edu/hm/hafner/analysis/GradleModuleDetectorTest.java @@ -3,8 +3,6 @@ import org.apache.commons.lang3.StringUtils; import org.junit.jupiter.api.Test; -import edu.hm.hafner.analysis.ModuleDetector.FileSystem; - import static org.assertj.core.api.Assertions.*; import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.*; diff --git a/src/test/java/edu/hm/hafner/analysis/JavaPackageDetectorTest.java b/src/test/java/edu/hm/hafner/analysis/JavaPackageDetectorTest.java index 093b94f77..89e1543f9 100644 --- a/src/test/java/edu/hm/hafner/analysis/JavaPackageDetectorTest.java +++ b/src/test/java/edu/hm/hafner/analysis/JavaPackageDetectorTest.java @@ -1,7 +1,6 @@ package edu.hm.hafner.analysis; import java.io.IOException; -import java.io.InputStream; import org.apache.commons.io.IOUtils; import org.junit.jupiter.api.Test; diff --git a/src/test/java/edu/hm/hafner/analysis/KotlinPackageDetectorTest.java b/src/test/java/edu/hm/hafner/analysis/KotlinPackageDetectorTest.java index 632ae33b4..f1cf1f654 100644 --- a/src/test/java/edu/hm/hafner/analysis/KotlinPackageDetectorTest.java +++ b/src/test/java/edu/hm/hafner/analysis/KotlinPackageDetectorTest.java @@ -1,7 +1,6 @@ package edu.hm.hafner.analysis; import java.io.IOException; -import java.io.InputStream; import org.apache.commons.io.IOUtils; import org.junit.jupiter.api.Test; diff --git a/src/test/java/edu/hm/hafner/analysis/MavenModuleDetectorTest.java b/src/test/java/edu/hm/hafner/analysis/MavenModuleDetectorTest.java index 6de66e195..0922d0230 100644 --- a/src/test/java/edu/hm/hafner/analysis/MavenModuleDetectorTest.java +++ b/src/test/java/edu/hm/hafner/analysis/MavenModuleDetectorTest.java @@ -3,8 +3,6 @@ import org.apache.commons.lang3.StringUtils; import org.junit.jupiter.api.Test; -import edu.hm.hafner.analysis.ModuleDetector.FileSystem; - import static org.assertj.core.api.Assertions.*; import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.*; diff --git a/src/test/java/edu/hm/hafner/analysis/OsgiModuleDetectorTest.java b/src/test/java/edu/hm/hafner/analysis/OsgiModuleDetectorTest.java index d6704c8d8..9514cc641 100644 --- a/src/test/java/edu/hm/hafner/analysis/OsgiModuleDetectorTest.java +++ b/src/test/java/edu/hm/hafner/analysis/OsgiModuleDetectorTest.java @@ -3,8 +3,6 @@ import org.apache.commons.lang3.StringUtils; import org.junit.jupiter.api.Test; -import edu.hm.hafner.analysis.ModuleDetector.FileSystem; - import static org.assertj.core.api.Assertions.*; import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.*; diff --git a/src/test/java/edu/hm/hafner/analysis/PackageDetectorsTest.java b/src/test/java/edu/hm/hafner/analysis/PackageDetectorsTest.java index d6b93d89e..4caee2cdb 100644 --- a/src/test/java/edu/hm/hafner/analysis/PackageDetectorsTest.java +++ b/src/test/java/edu/hm/hafner/analysis/PackageDetectorsTest.java @@ -1,7 +1,6 @@ package edu.hm.hafner.analysis; import java.io.IOException; -import java.io.InputStream; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; @@ -11,12 +10,13 @@ import edu.hm.hafner.analysis.PackageDetectors.FileSystem; import edu.hm.hafner.util.ResourceTest; + import static org.assertj.core.api.Assertions.*; import static org.mockito.Mockito.*; /** * Tests the class {@link PackageDetectors}. - * + * * @author Ullrich Hafner */ class PackageDetectorsTest extends ResourceTest { diff --git a/src/test/java/edu/hm/hafner/analysis/ReportTest.java b/src/test/java/edu/hm/hafner/analysis/ReportTest.java index 69f6a2629..3690da9be 100644 --- a/src/test/java/edu/hm/hafner/analysis/ReportTest.java +++ b/src/test/java/edu/hm/hafner/analysis/ReportTest.java @@ -9,7 +9,6 @@ import java.util.Map; import java.util.NoSuchElementException; import java.util.Set; -import java.util.UUID; import java.util.function.BiFunction; import java.util.function.Consumer; import java.util.function.Function; diff --git a/src/test/java/edu/hm/hafner/analysis/parser/JcReportParserTest.java b/src/test/java/edu/hm/hafner/analysis/parser/JcReportParserTest.java index 5c7f0ae08..3eb1aeb14 100644 --- a/src/test/java/edu/hm/hafner/analysis/parser/JcReportParserTest.java +++ b/src/test/java/edu/hm/hafner/analysis/parser/JcReportParserTest.java @@ -4,12 +4,9 @@ import edu.hm.hafner.analysis.ParsingCanceledException; 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.analysis.assertions.SoftAssertions; -import edu.hm.hafner.analysis.parser.jcreport.File; -import edu.hm.hafner.analysis.parser.jcreport.Item; import edu.hm.hafner.analysis.parser.jcreport.JcReportParser; import edu.hm.hafner.analysis.registry.AbstractParserTest; diff --git a/src/test/java/edu/hm/hafner/analysis/parser/ParserBenchmark.java b/src/test/java/edu/hm/hafner/analysis/parser/ParserBenchmark.java index 25d641073..b0448d6ad 100644 --- a/src/test/java/edu/hm/hafner/analysis/parser/ParserBenchmark.java +++ b/src/test/java/edu/hm/hafner/analysis/parser/ParserBenchmark.java @@ -17,7 +17,6 @@ import edu.hm.hafner.analysis.AbstractBenchmark; import edu.hm.hafner.analysis.FileReaderFactory; import edu.hm.hafner.analysis.ReaderFactory; -import edu.hm.hafner.analysis.Report; import edu.hm.hafner.analysis.parser.checkstyle.CheckStyleParser; import edu.hm.hafner.analysis.parser.pmd.PmdParser; diff --git a/src/test/java/edu/hm/hafner/analysis/parser/PmdParserTest.java b/src/test/java/edu/hm/hafner/analysis/parser/PmdParserTest.java index 94de714c6..c5c370916 100644 --- a/src/test/java/edu/hm/hafner/analysis/parser/PmdParserTest.java +++ b/src/test/java/edu/hm/hafner/analysis/parser/PmdParserTest.java @@ -81,42 +81,42 @@ void issue54736() { .hasFileName( "/Users/jordillach/DemoTenants/Tenants/vhosts/pre.elperiodico.com/themes/default/articleTemplates/forceOpinion.s.jsp") .hasMessage( - "Error while parsing /Users/jordillach/DemoTenants/Tenants/vhosts/pre.elperiodico.com/themes/default/articleTemplates/forceOpinion.s.jsp") - .hasDescription( - """ - "