Skip to content

Commit

Permalink
Merge pull request #924 from hazendaz/next-up
Browse files Browse the repository at this point in the history
[ci] Run eclipse formatter against the code
  • Loading branch information
hazendaz authored Nov 11, 2024
2 parents 62ddea0 + 1b6f4bf commit 028a1a3
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {
sourceFiles.addAll(FileUtils.listFiles(testClassFilesDirectory, SpotBugsInfo.EXTENSIONS, true))
}

log.debug('SourceFiles: ' + Arrays.toString(sourceFiles));
log.debug('SourceFiles: ' + Arrays.toString(sourceFiles))
!sourceFiles.isEmpty()
}

Expand All @@ -458,5 +458,4 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {
log.error(bug.LongMessage.text() + SpotBugsInfo.BLANK + bug.SourceLine.'@classname' + SpotBugsInfo.BLANK + bug.SourceLine.Message.text() + SpotBugsInfo.BLANK + bug.'@type')
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ final class ResourceHelper {
log.debug('location of resourceFile file is ' + resourceFile.absolutePath)

return resourceFile

}

private File getResourceAsFile(String name, String outputPath) {
Expand Down Expand Up @@ -115,12 +114,10 @@ final class ResourceHelper {
FileOutputStream os = new FileOutputStream(outputResourceFile)

os << is

} catch (IOException e) {
throw new FileResourceCreationException('Cannot create file-based resource.', e)
}

return outputResourceFile
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ class SourceFileIndexer {
}
}
}

}

/**
Expand Down Expand Up @@ -136,5 +135,4 @@ class SourceFileIndexer {
// Not found
return null
}

}
7 changes: 3 additions & 4 deletions src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsGui.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ package org.codehaus.mojo.spotbugs

import groovy.ant.AntBuilder

import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.charset.Charset
import java.nio.charset.StandardCharsets

import javax.inject.Inject

Expand Down Expand Up @@ -149,7 +149,7 @@ class SpotBugsGui extends AbstractMojo implements SpotBugsPluginsTrait {

log.info('File Encoding is ' + effectiveEncoding.name())

sysproperty(key: "file.encoding" , value: effectiveEncoding.name())
sysproperty(key: 'file.encoding' , value: effectiveEncoding.name())

// spotbugs assumes that multiple arguments (because of options) means text mode, so need to request gui explicitly
jvmarg(value: '-Dfindbugs.launchUI=gui2')
Expand Down Expand Up @@ -188,5 +188,4 @@ class SpotBugsGui extends AbstractMojo implements SpotBugsPluginsTrait {
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ interface SpotBugsInfo {
static final String JAVA_SOURCES_KEY = 'report.spotbugs.javasources'

/** The extensions to search files for. */
static final String[] EXTENSIONS = [ 'class' ]
static final String[] EXTENSIONS = ['class']

/** The comma character. */
static final String COMMA = ','
Expand Down Expand Up @@ -82,5 +82,10 @@ interface SpotBugsInfo {
Map<String, String> spotbugsThresholds = [High: 'high', Exp: 'experimental', Low: 'low', Medium: 'medium', Default: 'medium']

/** The spotbugs priority as unknown, high, medium, and low. */
List<String> spotbugsPriority = ['unknown', 'High', 'Medium', 'Low']
List<String> spotbugsPriority = [
'unknown',
'High',
'Medium',
'Low'
]
}
19 changes: 4 additions & 15 deletions src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsMojo.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import groovy.ant.AntBuilder
import groovy.json.JsonBuilder
import groovy.json.JsonSlurper
import groovy.xml.XmlSlurper
import groovy.xml.slurpersupport.GPathResult;
import groovy.xml.slurpersupport.GPathResult
import groovy.xml.StreamingMarkupBuilder

import org.apache.maven.doxia.siterenderer.Renderer
Expand All @@ -37,7 +37,7 @@ import org.codehaus.plexus.resource.ResourceManager
import org.codehaus.plexus.resource.loader.FileResourceLoader

import java.nio.charset.Charset
import java.nio.charset.StandardCharsets;
import java.nio.charset.StandardCharsets
import java.nio.file.Files
import java.nio.file.Paths
import java.util.stream.Collectors
Expand Down Expand Up @@ -369,7 +369,7 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
* @since 4.8.3.0 includes classifier
*/
@Parameter
PluginArtifact[] plugins;
PluginArtifact[] plugins

/**
* Restrict analysis to the given comma-separated list of classes and packages.
Expand Down Expand Up @@ -717,7 +717,6 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {

xDocsReporter.generateReport()
}

}

/**
Expand Down Expand Up @@ -803,7 +802,7 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
}

if (htmlOutput) {
args << '-html=' + htmlTempFile.getAbsolutePath()
args << '-html=' + htmlTempFile.getAbsolutePath()
}

args << '-xml:withMessages=' + xmlTempFile.getAbsolutePath()
Expand Down Expand Up @@ -870,7 +869,6 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
args << '-include'
args << resourceHelper.getResourceFile(includefilter.trim())
}

}

if (includeFilterFiles) {
Expand All @@ -880,7 +878,6 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
args << '-include'
args << resourceHelper.getResourceFile(includefilter.trim())
}

}

if (excludeFilterFile) {
Expand All @@ -891,7 +888,6 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
args << '-exclude'
args << resourceHelper.getResourceFile(excludeFilter.trim())
}

}

if (excludeFilterFiles) {
Expand All @@ -901,7 +897,6 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
args << '-exclude'
args << resourceHelper.getResourceFile(excludeFilter.trim())
}

}

if (excludeBugsFile) {
Expand Down Expand Up @@ -1109,7 +1104,6 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
log.debug("System property ${sysProp.key} is ${sysProp.value}")
sysproperty(key: sysProp.key, value: sysProp.value)
}

}

long duration
Expand Down Expand Up @@ -1182,7 +1176,6 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
if (!log.isDebugEnabled()) {
xmlTempFile.delete()
}

}

if (sarifTempFile && sarifOutput && sarifTempFile.size() > 0) {
Expand Down Expand Up @@ -1218,7 +1211,6 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
+ 'The path include in the SARIF report could be incomplete.')
}
}

}
}

Expand All @@ -1233,7 +1225,6 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
sarifTempFile.delete()
}
}

}

/**
Expand Down Expand Up @@ -1272,7 +1263,6 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
log.debug("thresholdParameter is ${thresholdParameter}")

return thresholdParameter

}

/**
Expand All @@ -1285,5 +1275,4 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
super.setReportOutputDirectory(reportOutputDirectory)
this.outputDirectory = reportOutputDirectory
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -144,5 +144,4 @@ trait SpotBugsPluginsTrait {

return "-effort:" + effortParameter
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -638,5 +638,4 @@ class SpotbugsReportGenerator implements SpotBugsInfo {

return value
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import edu.umd.cs.findbugs.Version
import groovy.xml.slurpersupport.GPathResult
import groovy.xml.StreamingMarkupBuilder

import java.nio.charset.StandardCharsets;
import java.nio.charset.StandardCharsets

import org.apache.maven.plugin.logging.Log

Expand Down Expand Up @@ -163,7 +163,7 @@ class XDocsReporter {
spotbugsResults.BugInstance.each() { bugInstance ->

if (bugInstance.Class.find{ it.@primary == "true" }.@classname.text() != bugClass) {
return
return
}

String type = bugInstance.@type.text()
Expand Down Expand Up @@ -215,5 +215,4 @@ class XDocsReporter {
outputWriter << xmlBuilder.bind(xdoc)
outputWriter.close()
}

}

0 comments on commit 028a1a3

Please sign in to comment.