Skip to content

Commit 09a1816

Browse files
authored
Merge pull request #1198 from JuditKnoll/cleanup
small cleanup
2 parents 0cb89f2 + 7b2abe6 commit 09a1816

6 files changed

Lines changed: 18 additions & 18 deletions

File tree

src/main/groovy/org/codehaus/mojo/spotbugs/BaseViolationCheckMojo.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,19 +197,19 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {
197197
}
198198

199199
private boolean doSourceFilesExist() {
200-
boolean foundClassFiles = false;
200+
boolean foundClassFiles = false
201201
List<String> classFilesList = []
202202
if (this.classFilesDirectory.isDirectory()) {
203203
foundClassFiles = walkFiles(classFilesList, classFilesDirectory, foundClassFiles)
204204
}
205205

206-
boolean foundTestFiles = false;
206+
boolean foundTestFiles = false
207207
List<String> testFilesList = []
208208
if (this.includeTests && this.testClassFilesDirectory.isDirectory()) {
209209
foundTestFiles = walkFiles(testFilesList, testClassFilesDirectory, foundTestFiles)
210210
}
211211

212-
return foundClassFiles || foundTestFiles;
212+
return foundClassFiles || foundTestFiles
213213
}
214214

215215
private boolean walkFiles(List filesList, File filesDirectory, boolean foundFiles) {

src/main/groovy/org/codehaus/mojo/spotbugs/ResourceHelper.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,14 @@ final class ResourceHelper {
9393
if (new File(name).exists()) {
9494
// Avoid copying the file onto itself
9595
if (Path.of(name).toAbsolutePath().normalize().equals(outputResourcePath.toAbsolutePath().normalize())) {
96-
return outputResourcePath;
96+
return outputResourcePath
9797
}
9898

9999
createParentDirectories(outputResourcePath)
100100

101101
// Copy existing file (not a URL)
102102
return Files.copy(Path.of(name), outputResourcePath, StandardCopyOption.REPLACE_EXISTING,
103-
StandardCopyOption.COPY_ATTRIBUTES);
103+
StandardCopyOption.COPY_ATTRIBUTES)
104104
}
105105

106106
// Copying resource from classpath to a file
@@ -124,7 +124,7 @@ final class ResourceHelper {
124124
return outputResourcePath
125125
}
126126

127-
private createParentDirectories(Path outputResourcePath) {
127+
private static createParentDirectories(Path outputResourcePath) {
128128
Path parent = outputResourcePath.getParent()
129129
if (parent != null && Files.notExists(parent)) {
130130
Files.createDirectories(parent)

src/main/groovy/org/codehaus/mojo/spotbugs/SourceFileIndexer.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ class SourceFileIndexer {
135135
* @param path Path to clean up
136136
* @return Path safe to use for comparison
137137
*/
138-
private String normalizePath(String path) {
138+
private static String normalizePath(String path) {
139139
return path.replace('\\', '/')
140140
}
141141

src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsMojo.groovy

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -563,25 +563,25 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
563563
log.debug("canGenerate is ${canGenerate}")
564564
}
565565

566-
boolean isSiteLifecycle = false;
566+
boolean isSiteLifecycle = false
567567
if (session != null && session.getRequest() != null) {
568-
List<String> goals = session.getRequest().getGoals();
568+
List<String> goals = session.getRequest().getGoals()
569569
if (goals != null && goals.any { String goal -> goal == "site" || goal.startsWith("site:") }) {
570-
isSiteLifecycle = true;
570+
isSiteLifecycle = true
571571
}
572572
}
573573

574574
if (canGenerate) {
575575
if (!isSiteLifecycle) {
576576
// Only generate xdoc report, skip site pages
577577
generateXDoc(getLocale())
578-
return false;
578+
return false
579579
}
580580
} else {
581581
log.info('No files found to run spotbugs, check compile phase has been run')
582582
}
583583

584-
return canGenerate;
584+
return canGenerate
585585
}
586586

587587
/**
@@ -1071,7 +1071,7 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
10711071
*
10721072
* @param file Destination file to create.
10731073
*/
1074-
private void forceFileCreation(File file) {
1074+
private static void forceFileCreation(File file) {
10751075
if (file.exists()) {
10761076
file.delete()
10771077
}
@@ -1381,7 +1381,7 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
13811381
* @see AbstractMavenReport#setReportOutputDirectory(File)
13821382
*/
13831383
@Override
1384-
public void setReportOutputDirectory(File reportOutputDirectory) {
1384+
void setReportOutputDirectory(File reportOutputDirectory) {
13851385
super.setReportOutputDirectory(reportOutputDirectory)
13861386
this.outputDirectory = reportOutputDirectory
13871387
}

src/main/groovy/org/codehaus/mojo/spotbugs/SpotbugsReportGenerator.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ class SpotbugsReportGenerator implements SpotBugsInfo {
595595
log.debug("Exiting printFilesSummary")
596596
}
597597

598-
public void generateReport() {
598+
void generateReport() {
599599
if (log.isDebugEnabled()) {
600600
log.debug('Reporter Locale is ' + this.bundle.getLocale().getLanguage())
601601
}

src/main/groovy/org/codehaus/mojo/spotbugs/XDocsReporter.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class XDocsReporter {
8787
* The ThresholdValue integer to evaluate.
8888
* @return The string valueof the Threshold object.
8989
*/
90-
protected String evaluateThresholdParameter(String thresholdValue) {
90+
protected static String evaluateThresholdParameter(String thresholdValue) {
9191
switch (thresholdValue) {
9292
case '1': return 'High'
9393
case '2': return 'Normal'
@@ -103,11 +103,11 @@ class XDocsReporter {
103103
*
104104
* @return The Spotbugs Version used on the report.
105105
*/
106-
protected String getSpotBugsVersion() {
106+
protected static String getSpotBugsVersion() {
107107
return Version.VERSION_STRING
108108
}
109109

110-
public void generateReport() {
110+
void generateReport() {
111111
StreamingMarkupBuilder xmlBuilder = new StreamingMarkupBuilder()
112112
xmlBuilder.encoding = outputEncoding.name()
113113

0 commit comments

Comments
 (0)