Added spotbugs settings & annotations.

This commit is contained in:
Erik C. Thauvin 2018-07-13 00:39:21 -07:00
parent 2dc748be75
commit f501e6c073
5 changed files with 54 additions and 50 deletions

View file

@ -32,6 +32,7 @@
package net.thauvin.erik.mobibot;
import com.rometools.rome.io.FeedException;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import net.thauvin.erik.mobibot.modules.*;
import net.thauvin.erik.semver.Version;
import org.apache.commons.cli.*;
@ -294,15 +295,16 @@ public class Mobibot extends PircBot {
*
* @param args The command line arguments.
*/
@SuppressFBWarnings(value = {"INFORMATION_EXPOSURE_THROUGH_AN_ERROR_MESSAGE", "DM_DEFAULT_ENCODING"})
public static void main(final String[] args) {
// Setup the command line options
final Options options = new Options();
options.addOption(Commands.HELP_ARG.substring(0, 1), Commands.HELP_ARG, false, "print this help message");
options.addOption(Commands.DEBUG_ARG.substring(0, 1), Commands.DEBUG_ARG, false,
"print debug & logging data directly to the console");
"print debug & logging data directly to the console");
options.addOption(Option.builder(
Commands.PROPS_ARG.substring(0, 1)).hasArg().argName("file").desc("use " + "alternate properties file")
.longOpt(Commands.PROPS_ARG).build());
Commands.PROPS_ARG.substring(0, 1)).hasArg().argName("file").desc("use " + "alternate properties file")
.longOpt(Commands.PROPS_ARG).build());
options.addOption(Commands.VERSION_ARG.substring(0, 1), Commands.VERSION_ARG, false, "print version info");
// Parse the command line
@ -418,6 +420,7 @@ public class Mobibot extends PircBot {
/**
* Connects to the server and joins the channel.
*/
@SuppressFBWarnings(value = {"DM_EXIT", "INFORMATION_EXPOSURE_THROUGH_AN_ERROR_MESSAGE"})
public final void connect() {
try {
connect(ircServer, ircPort);
@ -1287,6 +1290,7 @@ public class Mobibot extends PircBot {
/**
* {@inheritDoc}
*/
@SuppressFBWarnings(value = "DM_EXIT", justification = "Yes, we want to bail out.")
@Override
protected final void onPrivateMessage(final String sender,
final String login,

View file

@ -1,5 +1,6 @@
package net.thauvin.erik.mobibot;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import twitter4j.TwitterException;
import twitter4j.TwitterFactory;
import twitter4j.auth.AccessToken;
@ -27,8 +28,9 @@ import java.io.InputStreamReader;
* @since 1.0
*/
public final class TwitterOAuth {
@SuppressFBWarnings(value = "DM_DEFAULT_ENCODING")
public static void main(final String[] args)
throws Exception {
throws Exception {
if (args.length == 2) {
final twitter4j.Twitter twitter = new TwitterFactory().getInstance();
twitter.setOAuthConsumer(args[0], args[1]);

View file

@ -31,6 +31,7 @@
*/
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.jdom2.Document;
@ -114,6 +115,7 @@ final public class CurrencyConverter extends AbstractModule {
/**
* Converts the specified currencies.
*/
@SuppressFBWarnings(value = "REDOS")
private void run(final Mobibot bot, final String sender, final String query) {
if (Utils.isValidString(sender)) {
if (EXCHANGE_RATES.isEmpty()) {