This is the first step for adding spotbugs (formerly findbugs) back into

the build.  The configuration is in place but the majority of the
projects are being excluded.  The eventlog (a small sample size) is
however being run with the proper corrections commited.
This commit is contained in:
Cyrus 2023-12-20 12:55:50 -05:00
parent a30b81a68e
commit 4a9c579822
2 changed files with 28 additions and 8 deletions

View File

@ -4,11 +4,28 @@ import org.gradle.api.tasks.Copy
plugins { plugins {
// Apply the application plugin to add support for building a CLI application in Java. // Apply the application plugin to add support for building a CLI application in Java.
id 'application' id 'application'
id 'com.github.spotbugs' version '6.0.4' apply false
} }
// Global checkstyle file // Global checkstyle file
ext.checkstyleConfigFile = new File(rootDir, "/config/checkstyle/sun_checks.xml") ext.checkstyleConfigFile = new File(rootDir, "/config/checkstyle/sun_checks.xml")
subprojects {
apply plugin: "com.github.spotbugs"
spotbugs {
excludeFilter = file('config/spotbugs/spotbugs-exclude.xml')
}
tasks.withType(com.github.spotsbugs.snom.SpotBugsTask) {
reports {
html {
enabled = true
}
}
}
}
dependencies { dependencies {
repositories { repositories {
// Use Maven Central for resolving dependencies. // Use Maven Central for resolving dependencies.

View File

@ -59,10 +59,10 @@ public class Commander {
if (hasArguments) { if (hasArguments) {
parseArguments(args); parseArguments(args);
} else { } else {
String[] defualtArgs = new String[1]; String[] defaultArgs = new String[1];
defualtArgs[0] = "-e"; defaultArgs[0] = "-e";
hasArguments = true; hasArguments = true;
parseArguments(defualtArgs); parseArguments(defaultArgs);
} }
} }
@ -445,14 +445,17 @@ public class Commander {
* @return true if path is valid * @return true if path is valid
*/ */
public static boolean isValidPath(final String filepath) { public static boolean isValidPath(final String filepath) {
try {
System.out.println("Checking for a valid creation path..."); System.out.println("Checking for a valid creation path...");
if (filepath != null) {
return false;
}
try {
File file = new File(filepath); File file = new File(filepath);
boolean test = file.createNewFile(); boolean test = file.createNewFile();
if (!test) { if (!test) {
return false; return false;
} }
} catch (IOException | InvalidPathException | NullPointerException ex) { } catch (IOException | InvalidPathException ex) {
return false; return false;
} }
return true; return true;