Showing 27 of 108 total issues
Method filter
has a Cognitive Complexity of 136 (exceeds 20 allowed). Consider refactoring. Open
suspend fun filter(e: GroupMessageEvent) {
if (!ModuleStateConfig.messageFilter) return
var muted = false
// 检查权限
- 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 ltd_guimc_command_hypixel
has a Cognitive Complexity of 116 (exceeds 20 allowed). Consider refactoring. Open
fun CommandSender.ltd_guimc_command_hypixel(name: String) = launch {
try {
requireNotNull(bot) { "Must have bot to use it" }
requireNotNull(user) { "Must have user to use it" }
- 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 predict
has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring. Open
public static int predict(double[] input, String[] script) {
double[] current = new double[input.length];
System.arraycopy(input, 0, current, 0, input.length);
for (String str : script) {
if (str.length() < 2) {
- 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 175 lines of code (exceeds 25 allowed). Consider refactoring. Open
suspend fun filter(e: GroupMessageEvent) {
if (!ModuleStateConfig.messageFilter) return
var muted = false
// 检查权限
Method update
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
public void update(String text) {
text = CharUtils.regularize(text);
LinkedList<String> engStr = new LinkedList<>();
if (smartEnglishContext) {
int[] charArray = text.codePoints().toArray();
- 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
File HypixelCommand.kt
has 384 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* THIS FILE IS PART OF lgz-bot PROJECT
*
* You must disclose the source code of your modified work and the source code you took from this project. This means you are not allowed to use code from this project (even partially) in a closed-source (or even obfuscated) application.
* Your modified application must also be licensed under the AGPLv3.
File Model.java
has 335 lines of code (exceeds 250 allowed). Consider refactoring. Open
package huzpsb.ll4j.model;
import huzpsb.ll4j.layer.*;
import huzpsb.ll4j.utils.data.DataEntry;
import huzpsb.ll4j.utils.data.DataSet;
Method iiIiIIiII1i1I1i1I1i1II1i1I1i1I1
has a Cognitive Complexity of 40 (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 predict
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static int predict(double[] input, String[] script) {
double[] current = new double[input.length];
System.arraycopy(input, 0, current, 0, input.length);
for (String str : script) {
if (str.length() < 2) {
Method onPush
has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring. Open
suspend fun onPush(event: JSONObject) {
val repo = event.getJSONObject("repository").getString("full_name")
event.getJSONArray("commits").forEach { rawcommit ->
val commit = rawcommit as JSONObject
val author = commit.getJSONObject("author")
- 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 trainOn
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public Pair<Integer, Integer> trainOn(DataSet dataSet, double learningRate) {
int t = 0, f = 0;
if (!(layers[layers.length - 1] instanceof JudgeLayer)) {
throw new RuntimeException("Last layer is not output layer");
}
- 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 update
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void update(String text) {
text = CharUtils.regularize(text);
LinkedList<String> engStr = new LinkedList<>();
if (smartEnglishContext) {
int[] charArray = text.codePoints().toArray();
Method trainAndGetWA
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public List<DataEntry> trainAndGetWA(DataSet dataSet, double learningRate) {
LinkedList<DataEntry> entries = new LinkedList<>();
if (!(layers[layers.length - 1] instanceof JudgeLayer)) {
throw new RuntimeException("Last layer is not output layer");
}
- 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 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
suspend fun onMessage(event: GroupMessageEvent) {
when(event.message.getPlainText()) {
"摸鱼", "摸鱼!", "摸鱼.",
"摸鱼!", "摸鱼。" -> {
if (ModuleStateConfig.moyu) {
Method resolveGameType
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
fun resolveGameType(gametype: String): String {
return when (gametype) {
"QUAKECRAFT" -> "Quake"
"WALLS" -> "Walls"
"PAINTBALL" -> "Paintball"
Method unFormatted
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
fun String.unFormatted(): String {
return this.replace("§0", "")
.replace("§1", "")
.replace("§2", "")
.replace("§3", "")
Method onPush
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
suspend fun onPush(event: JSONObject) {
val repo = event.getJSONObject("repository").getString("full_name")
event.getJSONArray("commits").forEach { rawcommit ->
val commit = rawcommit as JSONObject
val author = commit.getJSONObject("author")
Method trainOn
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public Pair<Integer, Integer> trainOn(DataSet dataSet, double learningRate) {
int t = 0, f = 0;
if (!(layers[layers.length - 1] instanceof JudgeLayer)) {
throw new RuntimeException("Last layer is not output layer");
}
Method trainAndGetWA
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public List<DataEntry> trainAndGetWA(DataSet dataSet, double learningRate) {
LinkedList<DataEntry> entries = new LinkedList<>();
if (!(layers[layers.length - 1] instanceof JudgeLayer)) {
throw new RuntimeException("Last layer is not output layer");
}
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 // 只处理对机器人的戳一戳