Showing 46 of 148 total issues
Method filter
has a Cognitive Complexity of 179 (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 112 (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 filter
has 230 lines of code (exceeds 25 allowed). Consider refactoring. Open
suspend fun filter(e: GroupMessageEvent) {
if (!ModuleStateConfig.messageFilter) return
var muted = false
// 检查权限
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 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 374 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 filterImage
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
private suspend fun filterImage(e: GroupMessageEvent, m: Image): Boolean {
var muted = false
try {
var content = sbc2dbcCase(recognizeAndStoreImage(m.cast<Image>().queryUrl()))
.lowercase()
Method filterImage
has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring. Open
private suspend fun filterImage(e: GroupMessageEvent, m: Image): Boolean {
var muted = false
try {
var content = sbc2dbcCase(recognizeAndStoreImage(m.cast<Image>().queryUrl()))
.lowercase()
- 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 MessageFilter.kt
has 300 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.
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 copyFileFromJar
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public static synchronized void copyFileFromJar(String filePath, String aimDir, boolean load, boolean deleteOnExit) throws IOException {
// 获取文件名并校验
String[] parts = filePath.split("/");
String filename = (parts.length > 1) ? parts[parts.length - 1] : null;
- 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 findLibLoader
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
static LibraryLoader findLibLoader(String engine) {
Properties props = new Properties();
try {
props.load(new StringReader(loaders));
- 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 recognizeAndStoreImage
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
fun recognizeAndStoreImage(imageUrl: String): String {
try {
// 获取图片数据
val imageRaw = HttpUtils.getBytesResponse(imageUrl)
if (imageRaw == null) {
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 loadFileIfNeeded
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
@SneakyThrows
public static void loadFileIfNeeded(Model model) {
String modelType = model.getModelType();
if (InferenceEngine.nativeLoader == null && (isLibraryLoaded.compareAndSet(false, true))) {
synchronized (InferenceEngine.class) {
- 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"