Removed spotbugs.

This commit is contained in:
Erik C. Thauvin 2021-05-12 19:03:14 -07:00
parent 0d3dc268ca
commit 694cc119ed
5 changed files with 14 additions and 79 deletions

View file

@ -2,7 +2,6 @@ plugins {
id 'application' id 'application'
id 'checkstyle' id 'checkstyle'
id 'com.github.ben-manes.versions' version '0.38.0' id 'com.github.ben-manes.versions' version '0.38.0'
id 'com.github.spotbugs' version '4.7.1'
id 'idea' id 'idea'
id 'io.gitlab.arturbosch.detekt' version '1.17.0-RC1' id 'io.gitlab.arturbosch.detekt' version '1.17.0-RC1'
id 'jacoco' id 'jacoco'
@ -23,7 +22,6 @@ final def semverProcessor = "net.thauvin.erik:semver:1.2.0"
ext.versions = [ ext.versions = [
log4j : '2.14.1', log4j : '2.14.1',
pmd : '6.34.0', pmd : '6.34.0',
spotbugs: '4.2.3'
] ]
repositories { repositories {
@ -61,19 +59,14 @@ dependencies {
implementation 'org.jsoup:jsoup:1.13.1' implementation 'org.jsoup:jsoup:1.13.1'
implementation 'org.twitter4j:twitter4j-core:4.0.7' 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.assertj:assertj-core:3.19.0'
testImplementation 'org.testng:testng:7.4.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 { test {
testLogging { testLogging {
exceptionFormat "full" exceptionFormat "full"
events /* "passed", */ "skipped", "failed"
} }
useTestNG() { useTestNG() {
options.suites('src/test/resources/testng.xml') options.suites('src/test/resources/testng.xml')
@ -106,22 +99,7 @@ compileJava {
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions { kotlinOptions {
jvmTarget = '11' jvmTarget = java.targetCompatibility.toString()
}
}
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
}
} }
} }
@ -213,7 +191,7 @@ task copyToDeployLib(type: Copy) {
} }
task deploy(dependsOn: ['clean', 'build', 'jar']) { 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' group = 'Publishing'
outputs.dir deployDir outputs.dir deployDir
inputs.files copyToDeploy inputs.files copyToDeploy

View file

@ -1,40 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<FindBugsFilter
xmlns="https://github.com/spotbugs/filter/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://github.com/spotbugs/filter/3.0.0 https://raw.githubusercontent.com/spotbugs/spotbugs/4.0.0/spotbugs/etc/findbugsfilter.xsd">
<Match>
<Or>
<Package name="net.thauvin.erik.mobibot.*"/>
<Package name="net.thauvin.erik.mobibot.commands.tell.*"/>
<Package name="net.thauvin.erik.mobibot.entries.*"/>
</Or>
<Or>
<Bug pattern="PATH_TRAVERSAL_IN"/>
<Bug pattern="PATH_TRAVERSAL_OUT"/>
</Or>
<Confidence value="2"/>
</Match>
<Match>
<Or>
<Class name="net.thauvin.erik.mobibot.Mobibot"/>
<Class name="net.thauvin.erik.mobibot.Pinboard"/>
<Class name="net.thauvin.erik.mobibot.FeedReader"/>
<Class name="net.thauvin.erik.mobibot.commands.tell.Tell"/>
<Class name="net.thauvin.erik.mobibot.commands.Versions"/>
<Package name="net.thauvin.erik.mobibot.modules.*"/>
<Package name="net.thauvin.erik.mobibot.entries.*"/>
</Or>
<Bug pattern="FCCD_FIND_CLASS_CIRCULAR_DEPENDENCY"/>
</Match>
<Match>
<Class name="net.thauvin.erik.mobibot.Mobibot"/>
<Method name="main"/>
<Bug pattern="PATH_TRAVERSAL_OUT"/>
<Confidence value="1"/>
</Match>
<Match>
<Source name="~.*\.kt"/>
</Match>
</FindBugsFilter>

View file

@ -32,7 +32,6 @@
package net.thauvin.erik.mobibot; package net.thauvin.erik.mobibot;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import twitter4j.TwitterException; import twitter4j.TwitterException;
import twitter4j.TwitterFactory; import twitter4j.TwitterFactory;
import twitter4j.auth.AccessToken; import twitter4j.auth.AccessToken;
@ -69,8 +68,7 @@ public final class TwitterOAuth {
* @throws TwitterException If an error occurs. * @throws TwitterException If an error occurs.
* @throws IOException If an IO error occurs. * @throws IOException If an IO error occurs.
*/ */
@SuppressFBWarnings({ "DM_DEFAULT_ENCODING", "IMC_IMMATURE_CLASS_PRINTSTACKTRACE" }) @SuppressWarnings({ "PMD.SystemPrintln" })
@SuppressWarnings({ "PMD.AvoidPrintStackTrace", "PMD.SystemPrintln" })
public static void main(final String[] args) throws TwitterException, IOException { public static void main(final String[] args) throws TwitterException, IOException {
if (args.length == 2) { if (args.length == 2) {
final twitter4j.Twitter twitter = new TwitterFactory().getInstance(); final twitter4j.Twitter twitter = new TwitterFactory().getInstance();

View file

@ -32,7 +32,6 @@
package net.thauvin.erik.mobibot.modules; package net.thauvin.erik.mobibot.modules;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import net.thauvin.erik.mobibot.Mobibot; import net.thauvin.erik.mobibot.Mobibot;
import net.thauvin.erik.mobibot.Utils; import net.thauvin.erik.mobibot.Utils;
import org.jetbrains.annotations.NotNull; 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" }; new String[]{ "Ace", "King", "Queen", "Jack", "10", "9", "8", "7", "6", "5", "4", "3", "2" };
// Suits for the deck of card // Suits for the deck of card
private static final String[] WAR_SUITS = new String[]{ "Hearts", "Spades", "Diamonds", "Clubs" }; private static final String[] WAR_SUITS = new String[]{ "Hearts", "Spades", "Diamonds", "Clubs" };
// Random
private static final SecureRandom RANDOM = new SecureRandom();
/** /**
* The default constructor. * The default constructor.
@ -72,24 +73,22 @@ public final class War extends AbstractModule {
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@SuppressFBWarnings("DMI_RANDOM_USED_ONLY_ONCE")
@Override @Override
public void commandResponse(@NotNull final String sender, public void commandResponse(@NotNull final String sender,
@NotNull final String cmd, @NotNull final String cmd,
@NotNull final String args, @NotNull final String args,
final boolean isPrivate) { final boolean isPrivate) {
final SecureRandom r = new SecureRandom();
int i; int i;
int y; int y;
while (true) { while (true) {
i = r.nextInt(WAR_DECK.length); i = RANDOM.nextInt(WAR_DECK.length);
y = r.nextInt(WAR_DECK.length); y = RANDOM.nextInt(WAR_DECK.length);
getBot().send(sender + " drew the " + bold(WAR_DECK[i]) + " of " getBot().send(sender + " drew the " + bold(WAR_DECK[i]) + " 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[r.nextInt(WAR_SUITS.length)])); getBot().action("drew the " + bold(WAR_DECK[y]) + " of "
+ bold(WAR_SUITS[RANDOM.nextInt(WAR_SUITS.length)]));
if (i != y) { if (i != y) {
break; break;

View file

@ -1,9 +1,9 @@
#Generated by the Semver Plugin for Gradle #Generated by the Semver Plugin for Gradle
#Tue May 11 17:49:06 PDT 2021 #Wed May 12 19:01:23 PDT 2021
version.buildmeta=730 version.buildmeta=751
version.major=0 version.major=0
version.minor=8 version.minor=8
version.patch=0 version.patch=0
version.prerelease=beta version.prerelease=beta
version.project=mobibot version.project=mobibot
version.semver=0.8.0-beta+730 version.semver=0.8.0-beta+751