detekt & spotbugs cleanup.

This commit is contained in:
Erik C. Thauvin 2020-03-28 13:17:07 -07:00
parent f7e2651619
commit 9b2dc8587f
4 changed files with 14 additions and 10 deletions

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<FindBugsFilter
xmlns="https://github.com/spotbugs/filter/3.0.0"
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/3.1.0/spotbugs/etc/findbugsfilter.xsd">
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.*"/>
@ -22,6 +22,7 @@
<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>

View file

@ -2,21 +2,24 @@
<SmellBaseline>
<Blacklist></Blacklist>
<Whitelist>
<ID>ComplexMethod:Links.kt$Links$commandResponse</ID>
<ID>ComplexCondition:UrlMgr.kt$UrlMgr$Ignore.isNotIgnored(sender) &amp;&amp; (cmds.size == 1 || !cmds[1].contains(bot.nick) || !cmds[1].endsWith(" (${Ignore.IGNORE_CMD}"))</ID>
<ID>ComplexMethod:Posting.kt$Posting$commandResponse</ID>
<ID>ComplexMethod:UrlMgr.kt$UrlMgr$commandResponse</ID>
<ID>ComplexMethod:View.kt$View$commandResponse</ID>
<ID>LongMethod:Links.kt$Links$commandResponse</ID>
<ID>LongMethod:Posting.kt$Posting$commandResponse</ID>
<ID>LongMethod:UrlMgr.kt$UrlMgr$commandResponse</ID>
<ID>LongMethod:View.kt$View$commandResponse</ID>
<ID>LongParameterList:AbstractCommand.kt$AbstractCommand$( bot: Mobibot, sender: String, login: String, args: String, isOp: Boolean, isPrivate: Boolean )</ID>
<ID>LoopWithTooManyJumpStatements:View.kt$View$while (i &lt; max) { entry = getEntry(i) if (lcArgs.isNotEmpty()) { if (entry.link.toLowerCase().contains(lcArgs) || entry.title.toLowerCase().contains(lcArgs) || entry.nick.toLowerCase().contains(lcArgs)) { if (sent &gt; maxEntries) { bot.send( sender, "To view more, try: " + Utils.bold("${bot.nick}: $command ${i + 1} $lcArgs"), isPrivate ) break } bot.send(sender, EntriesUtils.buildLink(i, entry, true), isPrivate) sent++ } } else { if (sent &gt; maxEntries) { bot.send( sender, "To view more, try: " + Utils.bold("${bot.nick}: $command ${i + 1}"), isPrivate ) break } bot.send(sender, EntriesUtils.buildLink(i, entry, true), isPrivate) sent++ } i++ }</ID>
<ID>MagicNumber:Comments.kt$Comments$3</ID>
<ID>MagicNumber:Comment.kt$Comment$3</ID>
<ID>MagicNumber:Cycle.kt$Cycle$10</ID>
<ID>MagicNumber:Recap.kt$Recap.Companion$10</ID>
<ID>MagicNumber:UrlMgr.kt$UrlMgr$1000L</ID>
<ID>MagicNumber:UrlMgr.kt$UrlMgr$60L</ID>
<ID>MagicNumber:View.kt$View$8</ID>
<ID>NestedBlockDepth:Comments.kt$Comments$commandResponse</ID>
<ID>NestedBlockDepth:Comment.kt$Comment$commandResponse</ID>
<ID>NestedBlockDepth:Ignore.kt$Ignore$commandResponse</ID>
<ID>NestedBlockDepth:Links.kt$Links$commandResponse</ID>
<ID>NestedBlockDepth:Posting.kt$Posting$commandResponse</ID>
<ID>NestedBlockDepth:UrlMgr.kt$UrlMgr$commandResponse</ID>
<ID>NestedBlockDepth:View.kt$View$commandResponse</ID>
</Whitelist>

View file

@ -45,7 +45,7 @@ class Ignore(defaultIgnore: String) : AbstractCommand() {
}
}
override val command = IGNORE
override val command = IGNORE_CMD
override val help = listOf(
Utils.bold("To check your ignore status:"),
Utils.helpIndent("%s: $command"),
@ -57,7 +57,7 @@ class Ignore(defaultIgnore: String) : AbstractCommand() {
override val isVisible = true
companion object {
const val IGNORE = "ignore"
const val IGNORE_CMD = "ignore"
private val ignored = HashSet<String>()
@JvmStatic

View file

@ -131,7 +131,7 @@ class UrlMgr(defaultTags: String, keywords: String) : AbstractCommand() {
if (Ignore.isNotIgnored(sender) && (cmds.size == 1
|| !cmds[1].contains(bot.nick)
|| !cmds[1].endsWith(" (${Ignore.IGNORE}"))) {
|| !cmds[1].endsWith(" (${Ignore.IGNORE_CMD}"))) {
val link = cmds[0].trim()
var isBackup = false
val dupIndex: Int = findDupEntry(link)