Showing 221 of 349 total issues
Method sort
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public int[] sort(int[] data) {
int[] arr = Arrays.copyOf(data, data.length);
List<List<Integer>> dataList = new ArrayList<>();
List<Integer> arrs = new ArrayList<>();
- 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 run
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public void run(){
try{
br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
ps = new PrintStream(socket.getOutputStream());
String line = 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 main
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static void main(String[] args) {
for (int k = 0; k < minSize; k++) {
stack[k] = new Point();
path[k] = new Point();
}
Method countToScore
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private int countToScore(int count, int block, Color color) {
if (block == 2)
return 0;
if (count == 5 && color == myColor)
return 0x3b9aca00;
- 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 readAll
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public void readAll() {
InputStream input = null;
BufferedReader br = null;
InputStreamReader ids = null;
try {
- 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 getPostfix
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public static List<ExpressionWord> getPostfix(Expression expression) {
List<ExpressionWord> midfix = expression.getWord(); //获取中缀表达式的经过词法分析器分析的结果集
List<ExpressionWord> result = new ArrayList<>(); //存储后缀表达式结果的List集合
Stack<ExpressionWord> operationStack = new Stack<>(); //操作符栈
- 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 SimplexMethodWithFraction.java
has 288 lines of code (exceeds 250 allowed). Consider refactoring. Open
package com.github.kuangcp.simplex.method;
import com.github.kuangcp.math.number.Fraction;
import lombok.extern.slf4j.Slf4j;
Method savedAll
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public void savedAll() {
BufferedWriter bw = null;
OutputStream out = null;
OutputStreamWriter os = 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 handleNotification
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void handleNotification(Notification notification, Object handback) {
//we only handle GARBAGE_COLLECTION_NOTIFICATION notifications here
if (notification.getType().equals(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION)) {
//get the information associated with this notification
- 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 paint
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void paint(Graphics g) {
super.paint(g);
if (Objects.isNull(hero)) {
hero = new Hero(20, 20, 4);
Consider simplifying this complex logical expression. Open
if (t.getX() - halfHeight >= h.getHx() && t.getX() - halfHeight <= h.getHx() + hx
&& t.getY() - halfWidth >= h.getHy() && t.getY() - halfWidth <= h.getHy() + hy
|| t.getX() - halfHeight >= h.getHx() && t.getX() - halfHeight <= h.getHx() + hx
&& t.getY() >= h.getHy() && t.getY() <= h.getHy() + hy
|| t.getX() - halfHeight >= h.getHx() && t.getX() - halfHeight <= h.getHx() + hx
Consider simplifying this complex logical expression. Open
if (leftX >= h.getHx() && leftX <= h.getHx() + hx
&& upY >= h.getHy() && upY <= h.getHy() + hy
|| t.getX() >= h.getHx() && t.getX() <= h.getHx() + hx
&& upY >= h.getHy() && upY <= h.getHy() + hy
|| rightX >= h.getHx() && rightX <= h.getHx() + hx
Consider simplifying this complex logical expression. Open
if (leftX >= h.getHx() && leftX <= h.getHx() + hx
&& downY >= h.getHy() && downY <= h.getHy() + hy
|| t.getX() >= h.getHx() && t.getX() <= h.getHx() + hx
&& downY >= h.getHy() && downY <= h.getHy() + hy
|| rightX >= h.getHx() && rightX <= h.getHx() + hx
Consider simplifying this complex logical expression. Open
if (t.getX() + halfHeight >= h.getHx() - 2 && t.getX() + halfHeight <= h.getHx() + hx
&& t.getY() + halfWidth >= h.getHy() && t.getY() + halfWidth <= h.getHy() + hy
|| t.getX() + halfHeight >= h.getHx() - 2 && t.getX() + halfHeight <= h.getHx() + hx
&& t.getY() >= h.getHy() && t.getY() <= h.getHy() + hy
|| t.getX() + halfHeight >= h.getHx() - 2 && t.getX() + halfHeight <= h.getHx() + hx
Tank
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
@Slf4j
public abstract class Tank extends AbstractLoopEvent implements VisualItem {
int x; // 坦克中心的横坐标
int y; // 坦克中心的纵坐标
int direct = 0; // 初始方向
Method findDiffIndexPoint
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public static int findDiffIndexPoint(String a, String b) {
if (StringUtils.equals(a, b)) {
return 0;
}
if (Objects.isNull(a)) {
- 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 in
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
T in(Class<T> target, InputStream inputStream) {
T object = null;
try {
Reader reader = new InputStreamReader(inputStream);
BufferedReader bufferedReader = new BufferedReader(reader);
- 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 TimeWheel.java
has 274 lines of code (exceeds 250 allowed). Consider refactoring. Open
package com.github.kuangcp.time.wheel;
import lombok.extern.slf4j.Slf4j;
import java.time.Duration;
Method findDiffIndex
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public static int findDiffIndex(String a, String b) {
if (StringUtils.equals(a, b)) {
return 0;
}
if (Objects.isNull(a)) {
- 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 saveDataBase
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public void saveDataBase() {
PreparedStatement ps = null;
Connection cn = null;
ResultSet rs = 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"