Showing 221 of 349 total issues
Method drawBomb
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public void drawBomb(Graphics g, JPanel panel) {
for (int i = 0; i < bombs.size(); i++) {
//取出炸弹
Bomb b = bombs.get(i);
if (b.life > 10) {
- 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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static void main(String[] args) throws InterruptedException {
log.info("start");
Thread sleep = new Thread(() -> {
while (true) {
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 main
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static void main(String[] s) {
String[] args = {"localhost", "10000"};
String serverName = args[0];
int port = Integer.parseInt(args[1]);
- 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 createArrayRecovery
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public void createArrayRecovery() {
try {
List<byte[]> data = new ArrayList<>();
while (true) {
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 init
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public void init() {
try {
keyIn = new BufferedReader(new InputStreamReader(System.in));
socket = new Socket("127.0.0.1", ChatProtocol.SERVER_PORT);
ps = new PrintStream(socket.getOutputStream());
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
public void run() {
try {
while (!stop) {
// 如果不设置超时时间会一直阻塞等待,导致客户端无法退出
selector.select(5000);
- 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 display
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private void display(String title, boolean titleTurn, List list, boolean turn) {
if (titleTurn) {
System.out.println(title);
} else {
System.out.print(title + " : ");
- 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 sampleWithNoRepeatedWithPutBack
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static <T> List<T> sampleWithNoRepeatedWithPutBack(Map<T, Integer> rateMap, int count) {
List<T> result = new ArrayList<>();
int total = 0;
for (Entry<T, Integer> entry : rateMap.entrySet()) {
total += entry.getValue();
- 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 martingale
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
long martingale(long principal, int count) {
if (count < 0) {
return principal;
}
long origin = principal;
- 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
Avoid too many return
statements within this method. Open
return 0x186a0;
Avoid too many return
statements within this method. Open
return 10;
Avoid too many return
statements within this method. Open
return insertWheel(ChronoUnit.SECONDS, this.currentSecond.get() + 1, node);
Avoid too many return
statements within this method. Open
return 0xf4240;
Avoid too many return
statements within this method. Open
return count != 2 || color != myColor || block != 1 ? 0 : 1;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return 10000;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return 100;
Avoid too many return
statements within this method. Open
return 1000;
Avoid too many return
statements within this method. Open
return 0;