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,16 +4,33 @@ import org.gradle.api.tasks.Copy
plugins {
// Apply the application plugin to add support for building a CLI application in Java.
id 'application'
id 'com.github.spotbugs' version '6.0.4' apply false
}
// Global checkstyle file
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 {
repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}
// Use Maven Central for resolving dependencies.
mavenCentral()
}
}
def projectVersion = rootProject.file('VERSION').text.trim()

View File

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