diff --git a/build.gradle b/build.gradle index d5efd48..5fe6323 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,6 @@ plugins { id 'application' id 'checkstyle' id 'com.github.ben-manes.versions' version '0.38.0' - id 'com.github.spotbugs' version '4.7.1' id 'idea' id 'io.gitlab.arturbosch.detekt' version '1.17.0-RC1' id 'jacoco' @@ -23,7 +22,6 @@ final def semverProcessor = "net.thauvin.erik:semver:1.2.0" ext.versions = [ log4j : '2.14.1', pmd : '6.34.0', - spotbugs: '4.2.3' ] repositories { @@ -61,19 +59,14 @@ dependencies { implementation 'org.jsoup:jsoup:1.13.1' implementation 'org.twitter4j:twitter4j-core:4.0.7' - compileOnly "com.github.spotbugs:spotbugs-annotations:$versions.spotbugs" - testCompileOnly "com.github.spotbugs:spotbugs-annotations:$versions.spotbugs" - testImplementation 'org.assertj:assertj-core:3.19.0' testImplementation 'org.testng:testng:7.4.0' - - spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.11.0' - spotbugsPlugins 'com.mebigfatguy.sb-contrib:sb-contrib:7.4.7' } test { testLogging { exceptionFormat "full" + events /* "passed", */ "skipped", "failed" } useTestNG() { options.suites('src/test/resources/testng.xml') @@ -106,22 +99,7 @@ compileJava { tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { kotlinOptions { - jvmTarget = '11' - } -} - -spotbugs { - toolVersion.set("$versions.spotbugs") - excludeFilter.set(file("$projectDir/config/spotbugs/excludeFilter.xml")) - tasks.spotbugsMain { - reports.create("html") { - enabled = true - } - } - tasks.spotbugsTest { - reports.create("html") { - enabled = true - } + jvmTarget = java.targetCompatibility.toString() } } @@ -213,7 +191,7 @@ task copyToDeployLib(type: Copy) { } task deploy(dependsOn: ['clean', 'build', 'jar']) { - description = 'Copies all needed files to the ${deployDir} directory.' + description = "Copies all needed files to the ${deployDir} directory." group = 'Publishing' outputs.dir deployDir inputs.files copyToDeploy diff --git a/config/spotbugs/excludeFilter.xml b/config/spotbugs/excludeFilter.xml deleted file mode 100644 index 21512f0..0000000 --- a/config/spotbugs/excludeFilter.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/java/net/thauvin/erik/mobibot/TwitterOAuth.java b/src/main/java/net/thauvin/erik/mobibot/TwitterOAuth.java index 8396fce..2690710 100644 --- a/src/main/java/net/thauvin/erik/mobibot/TwitterOAuth.java +++ b/src/main/java/net/thauvin/erik/mobibot/TwitterOAuth.java @@ -32,7 +32,6 @@ package net.thauvin.erik.mobibot; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import twitter4j.TwitterException; import twitter4j.TwitterFactory; import twitter4j.auth.AccessToken; @@ -69,8 +68,7 @@ public final class TwitterOAuth { * @throws TwitterException If an error occurs. * @throws IOException If an IO error occurs. */ - @SuppressFBWarnings({ "DM_DEFAULT_ENCODING", "IMC_IMMATURE_CLASS_PRINTSTACKTRACE" }) - @SuppressWarnings({ "PMD.AvoidPrintStackTrace", "PMD.SystemPrintln" }) + @SuppressWarnings({ "PMD.SystemPrintln" }) public static void main(final String[] args) throws TwitterException, IOException { if (args.length == 2) { final twitter4j.Twitter twitter = new TwitterFactory().getInstance(); diff --git a/src/main/java/net/thauvin/erik/mobibot/modules/War.java b/src/main/java/net/thauvin/erik/mobibot/modules/War.java index af9e1d4..8c18b9f 100644 --- a/src/main/java/net/thauvin/erik/mobibot/modules/War.java +++ b/src/main/java/net/thauvin/erik/mobibot/modules/War.java @@ -32,7 +32,6 @@ package net.thauvin.erik.mobibot.modules; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import net.thauvin.erik.mobibot.Mobibot; import net.thauvin.erik.mobibot.Utils; import org.jetbrains.annotations.NotNull; @@ -56,6 +55,8 @@ public final class War extends AbstractModule { new String[]{ "Ace", "King", "Queen", "Jack", "10", "9", "8", "7", "6", "5", "4", "3", "2" }; // Suits for the deck of card private static final String[] WAR_SUITS = new String[]{ "Hearts", "Spades", "Diamonds", "Clubs" }; + // Random + private static final SecureRandom RANDOM = new SecureRandom(); /** * The default constructor. @@ -72,24 +73,22 @@ public final class War extends AbstractModule { /** * {@inheritDoc} */ - @SuppressFBWarnings("DMI_RANDOM_USED_ONLY_ONCE") @Override public void commandResponse(@NotNull final String sender, @NotNull final String cmd, @NotNull final String args, final boolean isPrivate) { - final SecureRandom r = new SecureRandom(); - int i; int y; while (true) { - i = r.nextInt(WAR_DECK.length); - y = r.nextInt(WAR_DECK.length); + i = RANDOM.nextInt(WAR_DECK.length); + y = RANDOM.nextInt(WAR_DECK.length); getBot().send(sender + " drew the " + bold(WAR_DECK[i]) + " of " - + bold(WAR_SUITS[r.nextInt(WAR_SUITS.length)])); - getBot().action("drew the " + bold(WAR_DECK[y]) + " of " + bold(WAR_SUITS[r.nextInt(WAR_SUITS.length)])); + + bold(WAR_SUITS[RANDOM.nextInt(WAR_SUITS.length)])); + getBot().action("drew the " + bold(WAR_DECK[y]) + " of " + + bold(WAR_SUITS[RANDOM.nextInt(WAR_SUITS.length)])); if (i != y) { break; diff --git a/version.properties b/version.properties index bec7ede..7802055 100644 --- a/version.properties +++ b/version.properties @@ -1,9 +1,9 @@ #Generated by the Semver Plugin for Gradle -#Tue May 11 17:49:06 PDT 2021 -version.buildmeta=730 +#Wed May 12 19:01:23 PDT 2021 +version.buildmeta=751 version.major=0 version.minor=8 version.patch=0 version.prerelease=beta version.project=mobibot -version.semver=0.8.0-beta+730 +version.semver=0.8.0-beta+751