Showing 226 of 360 total issues
Method mouseMoved
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public void mouseMoved(MouseEvent e) {
int x = getGridXY(e.getX());
int y = getGridXY(e.getY());
x = x >= 0 ? x : 0;
x = x <= 14 ? x : 14;
- 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 found
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static void found(int[] arr, int left, int right, int data) {
int mid = (left + right) / 2;
if (arr[mid] == data) {
index = mid;
- 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 add
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public void add(String str) {
for (Function<String, Integer> function : functions) {
Integer hash = function.apply(str);
int index = hash / LEN_OF_BYTE;
if (log.isDebugEnabled()) {
- 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 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 readDataBase
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public void readDataBase() {
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"
Further reading
Method actionPerformed
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void actionPerformed(ActionEvent ae) {
if (ae.getActionCommand().equals(ButtonCommand.START)) {
this.startNewStage();
}
- 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 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 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 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 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
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
Avoid too many return
statements within this method. Open
return 10;
Avoid too many return
statements within this method. Open
return 1000;
Avoid too many return
statements within this method. Open
return 0;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return insertWheel(ChronoUnit.SECONDS, this.currentSecond.get() + seconds, node);
Avoid too many return
statements within this method. Open
return 0;