Showing 221 of 349 total issues
Method maxList
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public Integer maxList(List<Fraction> list, boolean isMax, boolean haveInfinity, boolean permitMinus) {
Integer index = null;
//有非数的集合
if (haveInfinity) {
Map<Integer, Fraction> tempMap = new HashMap<>();
Method check
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static boolean check(Color chess[][], int x, int y, Color color) {
int count = 0;
int tempX = x;
int tempY = y;
for (; contains(chess, x - 1, y, color); x--)
Method btnZeroActionPerformed
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
void btnZeroActionPerformed(ActionEvent e) {
if (flag) { //如果刚刚按下了运算符
txtResult.setText("");
if (dotFlag) {//判断之前是否输入了点运算符
txtResult.setText("0." + e.getActionCommand());
- 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 sampleWithNoRepeated
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public static <T> List<T> sampleWithNoRepeated(Map<T, Integer> rateMap, int count) {
List<T> result = new ArrayList<>();
for (int i = 0; i < count; i++) {
int total = 0;
for (Entry<T, Integer> entry : rateMap.entrySet()) {
- 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 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void run() {
while (hero.isAlive() && !exit) {
if (eventGroup.hasPressMoveEvent()) {
// log.info("eventGroup={}", eventGroup);
Method singleThreadMode
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static void singleThreadMode() throws InterruptedException {
Thread normal = new Thread(() -> log.info("normal"));
normal.setName("normal");
normal.start();
Method installGCMonitoring
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static void installGCMonitoring() {
//get all the GarbageCollectorMXBeans - there's one for each heap generation
//so probably two - the old generation and young generation
List<GarbageCollectorMXBean> gcbeans = java.lang.management.ManagementFactory.getGarbageCollectorMXBeans();
//Install a notifcation handler for each bean
Method action
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private void action() {
if (state == PersonState.FREEZE) {
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 singleThreadMode
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private static void singleThreadMode() throws InterruptedException {
Thread normal = new Thread(() -> log.info("normal"));
normal.setName("normal");
normal.start();
- 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 handleInput
has a Cognitive Complexity of 13 (exceeds 5 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();
- 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 parseArgs
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private int parseArgs(String[] args) throws UnknownHostException {
int base;
label:
for (base = 0; base < args.length; base++) {
switch (args[base]) {
- 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 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void run(){
try{
br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
ps = new PrintStream(socket.getOutputStream());
String line = null;
Method readDataBase
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void readDataBase() {
PreparedStatement ps = null;
Connection cn = null;
ResultSet rs = null;
Method readContent
has 38 lines of code (exceeds 25 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();
Method sort
has 37 lines of code (exceeds 25 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<>();
Method pushTimeWheel
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void pushTimeWheel(int seconds) {
Map<ChronoUnit, Integer> tempIndex = new HashMap<>(sortedSlots.size());
for (int i = 0; i < sortedSlots.size(); i++) {
ChronoUnit unit = sortedSlots.get(i);
Integer threshold = slots.get(unit);
Method initLogicButton
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void initLogicButton() {
txtResult.setEnabled(false);
txtResult.setEditable(false);
txtResult.setHorizontalAlignment(SwingConstants.RIGHT);
txtResult.setBounds(new Rectangle(33, 19, 310, 34));
Method paintComponent
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
protected void paintComponent(Graphics g) {
int offset = 4;
int r = 5;
int chessR = 20;
Method main
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static void main(String[] a) {
final CountDownLatch firstLatch = new CountDownLatch(1);
final CountDownLatch secondLatch = new CountDownLatch(1);
// 使用不可变对象
final BuildFactory.Builder builder = new BuildFactory.Builder();
Method keyPressed
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public void keyPressed(KeyEvent e) {
//加了if条件后 实现了墙的限制(如果是游戏中的道具,该怎么办)
if (e.getKeyCode() == KeyEvent.VK_A) {
hero.setDirect(2);
if (PlayStageMgr.instance.willInBorder(hero))
- 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"