detekt & spotbugs cleanup.
This commit is contained in:
parent
f7e2651619
commit
9b2dc8587f
4 changed files with 14 additions and 10 deletions
|
@ -1,8 +1,8 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<FindBugsFilter
|
<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"
|
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>
|
<Match>
|
||||||
<Or>
|
<Or>
|
||||||
<Package name="net.thauvin.erik.mobibot.*"/>
|
<Package name="net.thauvin.erik.mobibot.*"/>
|
||||||
|
@ -22,6 +22,7 @@
|
||||||
<Class name="net.thauvin.erik.mobibot.Pinboard"/>
|
<Class name="net.thauvin.erik.mobibot.Pinboard"/>
|
||||||
<Class name="net.thauvin.erik.mobibot.FeedReader"/>
|
<Class name="net.thauvin.erik.mobibot.FeedReader"/>
|
||||||
<Class name="net.thauvin.erik.mobibot.commands.tell.Tell"/>
|
<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.modules.*"/>
|
||||||
<Package name="net.thauvin.erik.mobibot.entries.*"/>
|
<Package name="net.thauvin.erik.mobibot.entries.*"/>
|
||||||
</Or>
|
</Or>
|
||||||
|
|
|
@ -2,21 +2,24 @@
|
||||||
<SmellBaseline>
|
<SmellBaseline>
|
||||||
<Blacklist></Blacklist>
|
<Blacklist></Blacklist>
|
||||||
<Whitelist>
|
<Whitelist>
|
||||||
<ID>ComplexMethod:Links.kt$Links$commandResponse</ID>
|
<ID>ComplexCondition:UrlMgr.kt$UrlMgr$Ignore.isNotIgnored(sender) && (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:UrlMgr.kt$UrlMgr$commandResponse</ID>
|
||||||
<ID>ComplexMethod:View.kt$View$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:UrlMgr.kt$UrlMgr$commandResponse</ID>
|
||||||
<ID>LongMethod:View.kt$View$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>LongParameterList:AbstractCommand.kt$AbstractCommand$( bot: Mobibot, sender: String, login: String, args: String, isOp: Boolean, isPrivate: Boolean )</ID>
|
||||||
<ID>LoopWithTooManyJumpStatements:View.kt$View$while (i < 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 > 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 > 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>LoopWithTooManyJumpStatements:View.kt$View$while (i < 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 > 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 > 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:Cycle.kt$Cycle$10</ID>
|
||||||
<ID>MagicNumber:Recap.kt$Recap.Companion$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>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: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:UrlMgr.kt$UrlMgr$commandResponse</ID>
|
||||||
<ID>NestedBlockDepth:View.kt$View$commandResponse</ID>
|
<ID>NestedBlockDepth:View.kt$View$commandResponse</ID>
|
||||||
</Whitelist>
|
</Whitelist>
|
||||||
|
|
|
@ -45,7 +45,7 @@ class Ignore(defaultIgnore: String) : AbstractCommand() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override val command = IGNORE
|
override val command = IGNORE_CMD
|
||||||
override val help = listOf(
|
override val help = listOf(
|
||||||
Utils.bold("To check your ignore status:"),
|
Utils.bold("To check your ignore status:"),
|
||||||
Utils.helpIndent("%s: $command"),
|
Utils.helpIndent("%s: $command"),
|
||||||
|
@ -57,7 +57,7 @@ class Ignore(defaultIgnore: String) : AbstractCommand() {
|
||||||
override val isVisible = true
|
override val isVisible = true
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val IGNORE = "ignore"
|
const val IGNORE_CMD = "ignore"
|
||||||
private val ignored = HashSet<String>()
|
private val ignored = HashSet<String>()
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
|
|
@ -131,7 +131,7 @@ class UrlMgr(defaultTags: String, keywords: String) : AbstractCommand() {
|
||||||
|
|
||||||
if (Ignore.isNotIgnored(sender) && (cmds.size == 1
|
if (Ignore.isNotIgnored(sender) && (cmds.size == 1
|
||||||
|| !cmds[1].contains(bot.nick)
|
|| !cmds[1].contains(bot.nick)
|
||||||
|| !cmds[1].endsWith(" (${Ignore.IGNORE}"))) {
|
|| !cmds[1].endsWith(" (${Ignore.IGNORE_CMD}"))) {
|
||||||
val link = cmds[0].trim()
|
val link = cmds[0].trim()
|
||||||
var isBackup = false
|
var isBackup = false
|
||||||
val dupIndex: Int = findDupEntry(link)
|
val dupIndex: Int = findDupEntry(link)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue