Showing 226 of 360 total issues
Method run
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public void run() {
while (true) {
try {
log.info("##### Waiting for client on port " + serverSocket.getLocalPort() + "...");
Socket server = serverSocket.accept();
- 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 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static void main(String[] args) {
DisposableServer server = HttpServer.create()
.route(routes -> routes
.get("/hello",
(request, response) -> {
Method shotEnemy
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void shotEnemy() {
final long nowMs = System.currentTimeMillis();
if (lastShotMs != 0 && nowMs - lastShotMs < shotCDMs) {
return;
}
Method setSeed
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public final synchronized void setSeed(int[] buf) {
int length = buf.length;
if (length == 0) {
throw new IllegalArgumentException("Seed buffer may not be empty");
Method init
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void init() {
//添加求解式的数据
String max = config.getString("Max");
String[] temp = max.split(",");
for (String data : temp) {
Method otherThreadWithOOM
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void otherThreadWithOOM() throws Exception {
// 如果将该集合定义在这里 就会被所有线程共享 被引用数会多, 不容易回收, 就容易引起全面的OOM 导致进程退出
// List<byte[]> data = new ArrayList<>();
Thread allocateMemory = new Thread(() -> {
Method handleInput
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void handleInput(Selector selector, SelectionKey key) throws IOException {
if (key.isValid()) {
if (key.isAcceptable()) {
// Accept the new connection
ServerSocketChannel ssc = (ServerSocketChannel) key.channel();
Method initPool
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected void initPool() {
if (Objects.isNull(property) || !property.isAbleToInit()) {
return;
}
Method finalMoveAction
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void finalMoveAction() {
final boolean sameDirect = actionContext.getSameDirectCounter() > actionContext.getCurRoundStep();
final boolean ablePassHero = PlayStageMgr.ablePassByHero(this);
final boolean ablePassHinder = PlayStageMgr.ablePassByHinder(this);
Method paint
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void paint(Graphics g) {
super.paint(g);
final StageBorder border = RoundMapMgr.instance.border;
g.fillRect(0, 0, border.getMaxX() + border.getMinX(), border.getMaxY() + border.getMinY());
Method main
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static void main(String[] args) {
ServerSocket serverSocket = null;
Socket socket = null;
OutputStream os = null;
InputStream is = null;
Consider simplifying this complex logical expression. Open
if (('a' <= exChar[i] && exChar[i] <= 'z') || ('A' <= exChar[i] && exChar[i] <= 'Z') || exChar[i] == '_' || ('0' <= exChar[i] && exChar[i] <= '9')) {
sb.append('.');
i = getI(exChar, i, sb);
} else {
throw new RuntimeException("词法错误!");
Method paint
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public void paint(Graphics g) {
super.paint(g);
final StageBorder border = RoundMapMgr.instance.border;
g.fillRect(0, 0, border.getMaxX() + border.getMinX(), border.getMaxY() + border.getMinY());
- 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 printWheel
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public void printWheel() {
log.info("sec:{} min:{} hour:{}", this.currentSecond.get(), this.currentMinute.get(),
this.currentHour.get());
for (ChronoUnit unit : wheels.keySet()) {
LinkedList[] lists = wheels.get(unit);
- 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 checkBong
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private void checkBong(Tank tank, Bullet bullet) {
if (!bullet.alive || !tank.isAlive()) {
return;
}
- 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 showResult
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private static void showResult(int maxRow, int maxCol, char[][] print) {
System.out.printf("最短路径的长度 %d\n\n", minSize);
System.out.print("最短的路径:");
for (int k = 0; k < minSize; k++) {
System.out.printf("(%d,%d) ", path[k].row, path[k].col);
- 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 keyPressed
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void keyPressed(KeyEvent e) {
// 启动关闭流程
if (e.getKeyCode() == KeyEvent.VK_Q && HoldingKeyEventMgr.instance.isCtrl()) {
System.exit(0);
- 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 originRun
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private void originRun() {
do {
// 每个子弹发射的延迟运动的时间
TankTool.yieldMsTime(55);
- 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 readContent
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private void readContent(Selector selector, SelectionKey sk) throws IOException {
SocketChannel sc = (SocketChannel) sk.channel();
ByteBuffer buff = ByteBuffer.allocate(1024);
StringBuilder content = new StringBuilder();
- 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 start
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private void start() throws Exception {
Selector selector = Selector.open();
//通过OPEN方法来打开一个未绑定的ServerSocketChannel 实例
ServerSocketChannel server = ServerSocketChannel.open();
- 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"