Skip to content

Commit

Permalink
Fix PMD and CheckStyle warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed Jan 15, 2025
1 parent c6d8a80 commit ef44e7f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public boolean canDisplayFile(final Issue issue) {

/**
* Returns the URL to the results of the same type of issues (i.e. same ID) in the reference build.
*
* <p>
* If no reference build is found, then an empty string is returned.
* </p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* build (started automatically or manually) will not evaluate a quality gate that considers the number of new warnings.
* This helps to start over from a clean state if the number of new warnings have been increased accidentally. Otherwise
* you won't get a successful build anymore until all new warnings have been fixed.
*
* <p>
* Technically, this command just adds a marker action to the selected build. Once a new build is running, this marker
* action will be checked for existence and the quality gate will be bypassed for one single build.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ public IssuesRecorder() {
*
* @return this
*/
@SuppressWarnings("PMD.NPathComplexity")
protected Object readResolve() {
if (sourceDirectories == null) {
sourceDirectories = new HashSet<>();
Expand Down Expand Up @@ -215,6 +216,7 @@ public List<WarningsQualityGate> getQualityGates() {
/**
* Defines the ID of the results. The ID is used as URL of the results and as name in UI elements. If no ID is
* given, then the ID of the associated result object is used.
*
* <p>
* Note: this property is not used if {@link #isAggregatingResults} is {@code false}. It is also not visible in the
* UI in order to simplify the user interface.
Expand Down Expand Up @@ -666,6 +668,7 @@ List<AnalysisResult> perform(final Run<?, ?> run, final FilePath workspace, fina
}
}

@SuppressWarnings("PMD.CognitiveComplexity")
private List<AnalysisResult> record(final Run<?, ?> run, final FilePath workspace, final TaskListener listener,
final ResultHandler resultHandler, final LogHandler logHandler) throws IOException, InterruptedException {
if (analysisTools.isEmpty()) {
Expand Down Expand Up @@ -727,10 +730,8 @@ private boolean isNotUnique(final Tool tool) {
if (StringUtils.isNotBlank(getId()) && StringUtils.isNotBlank(tool.getId())) {
return true;
}
if (StringUtils.isNotBlank(getName()) && StringUtils.isNotBlank(tool.getName())) {
return true;
}
return StringUtils.isNotBlank(getIcon()) && StringUtils.isNotBlank(tool.getIcon());
return StringUtils.isNotBlank(getName()) && StringUtils.isNotBlank(tool.getName())
|| StringUtils.isNotBlank(getIcon()) && StringUtils.isNotBlank(tool.getIcon());
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.jenkins.plugins.analysis.core.steps;

import java.io.IOException;
import java.io.Serial;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
Expand Down Expand Up @@ -63,6 +64,7 @@
*/
@SuppressWarnings({"PMD.ExcessivePublicCount", "PMD.ExcessiveImports", "PMD.TooManyFields", "PMD.DataClass", "PMD.CyclomaticComplexity", "PMD.ExcessiveClassLength", "PMD.GodClass"})
public class RecordIssuesStep extends Step implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private static final ValidationUtilities VALIDATION_UTILITIES = new ValidationUtilities();

Expand Down Expand Up @@ -149,6 +151,7 @@ public List<WarningsQualityGate> getQualityGates() {
/**
* Defines the ID of the results. The ID is used as URL of the results and as name in UI elements. If no ID is
* given, then the ID of the associated result object is used.
*
* <p>
* Note: this property is not used if {@link #isAggregatingResults} is {@code false}. It is also not visible in the
* UI in order to simplify the user interface.
Expand All @@ -171,6 +174,7 @@ public String getId() {
/**
* Defines the name of the results. The name is used for all labels in the UI. If no name is given, then the name of
* the associated {@link StaticAnalysisLabelProvider} is used.
*
* <p>
* Note: this property is not used if {@link #isAggregatingResults} is {@code false}. It is also not visible in the
* UI in order to simplify the user interface.
Expand Down

0 comments on commit ef44e7f

Please sign in to comment.