Showing 7 of 38 total issues
Method filter
has a Cognitive Complexity of 79 (exceeds 20 allowed). Consider refactoring. Open
suspend fun filter(e: GroupMessageEvent) {
var muted = false
// 检查权限
val textMessage = e.message.getPlainText()
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method filter
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
suspend fun filter(e: GroupMessageEvent) {
var muted = false
// 检查权限
val textMessage = e.message.getPlainText()
Method iiIiIIiII1i1I1i1I1i1II1i1I1i1I1
has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring. Open
@Handler
fun CommandSender.iiIiIIiII1i1I1i1I1i1II1i1I1i1I1(id: Long) = launch {
try {
if (bot == null) {
throw IllegalAccessError("请勿在控制台运行")
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method specialCheck
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
suspend fun specialCheck(e: GroupMessageEvent, textMessage: String) {
val name = PinyinUtils.convertToPinyin(textMessage).lowercase().replace(" ", "")
when {
(((name.contains("chen") || name.contains("cheng") || name.contains("cen")) &&
(name.contains("zi") || name.contains("zhi")) &&
Method specialCheck
has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring. Open
suspend fun specialCheck(e: GroupMessageEvent, textMessage: String) {
val name = PinyinUtils.convertToPinyin(textMessage).lowercase().replace(" ", "")
when {
(((name.contains("chen") || name.contains("cheng") || name.contains("cen")) &&
(name.contains("zi") || name.contains("zhi")) &&
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method onMessage
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
suspend fun onMessage(event: GroupMessageEvent) {
when(event.message.getPlainText()) {
"摸鱼", "摸鱼!", "摸鱼.",
"摸鱼!", "摸鱼。" -> {
try {
Method onNudge
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
suspend fun onNudge(e: NudgeEvent) {
val from = e.from as User
val timestamp = Instant.now().epochSecond
if (e.target != e.bot) return // 只处理对机器人的戳一戳