Kuangcp/JavaBase

View on GitHub

Showing 226 of 354 total issues

Avoid too many return statements within this method.
Open

        return 0;

    Avoid too many return statements within this method.
    Open

                return 0x186a0;
    Severity: Major
    Found in gui/src/main/java/com/github/kuangcp/gomoku/AI.java - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return 10;
      Severity: Major
      Found in gui/src/main/java/com/github/kuangcp/gomoku/AI.java - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return 0xf4240;
        Severity: Major
        Found in gui/src/main/java/com/github/kuangcp/gomoku/AI.java - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return 10000;
          Severity: Major
          Found in gui/src/main/java/com/github/kuangcp/gomoku/AI.java - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return 100;
            Severity: Major
            Found in gui/src/main/java/com/github/kuangcp/gomoku/AI.java - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return insertWheel(ChronoUnit.SECONDS, this.currentSecond.get() + seconds, node);
              Severity: Major
              Found in algorithms/src/main/java/com/github/kuangcp/time/wheel/TimeWheel.java - About 30 mins to fix

                Method sort has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  public int[] sort(int[] data) {
                    int[] result = Arrays.copyOf(data, data.length);
                
                    for (int i = 0; i < result.length - 1; i++) {
                      //这个循环就是把较小数堆叠在数组头,依次与后面比较再交换
                Severity: Minor
                Found in algorithms/src/main/java/com/github/kuangcp/sort/Select.java - About 25 mins to fix

                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 transferAllKey has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  void transferAllKey() throws InterruptedException {
                    boolean init = initRedisPool();
                    if (!init) {
                      return;
                    }
                Severity: Minor
                Found in concurrency/src/main/java/redis/migration/Main.java - About 25 mins to fix

                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 sort has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  public int[] sort(int[] data) {
                    int[] result = Arrays.copyOf(data, data.length);
                
                    for (int i = 1; i < result.length; i++) {
                      //用来冒泡的语句,0到已排序的部分
                Severity: Minor
                Found in algorithms/src/main/java/com/github/kuangcp/sort/Bubble.java - About 25 mins to fix

                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 willInfected has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public void willInfected() {
                        if (this.isInfected()) {
                            return;
                        }
                
                
                Severity: Minor
                Found in gui/src/main/java/com/github/kuangcp/virusbroadcast/domain/Person.java - About 25 mins to fix

                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 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public void run() {
                        File soundFile = new File(filename);
                
                        AudioInputStream audioInputStream;
                        try {
                Severity: Minor
                Found in gui/src/main/java/com/github/kuangcp/tank/util/Audio.java - About 25 mins to fix

                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 setSeed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  public final synchronized void setSeed(long seed) {
                    if (compact) {
                      setSeed((int) seed);
                    } else {
                      // Annoying runtime check for initialisation of internal data
                Severity: Minor
                Found in algorithms/src/main/java/com/github/kuangcp/random/MT19937Random.java - About 25 mins to fix

                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 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    @Override
                    public void run() {
                        int maxFPS = 60;
                        long fpsTime = (long) ((1000.0 / maxFPS) * 1_000_000);
                
                
                Severity: Minor
                Found in gui/src/main/java/com/github/kuangcp/tank/v2/MainPanelV2.java - About 25 mins to fix

                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 mouseClicked has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public void mouseClicked(MouseEvent e) {
                        if (playerPlay) {
                            int x = getGridXY(e.getX());
                            int y = getGridXY(e.getY());
                            if (hasChess(x, y))
                Severity: Minor
                Found in gui/src/main/java/com/github/kuangcp/gomoku/ChessBoard.java - About 25 mins to fix

                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 initBigInteger has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  private boolean initBigInteger(String target, MythBaseStack<Integer> stack) {
                    String regex = "^[0-9]+$";
                    boolean oneResult = Pattern.matches(regex, target);
                    if (!oneResult) {
                      log.error("there are not integer: one={}", target);

                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 E1 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    private void E1() {
                        if (sym == 1) {
                            next();
                            T();
                            E1();

                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 T1 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    private void T1() {
                        if (sym == 3) {
                            next();
                            F();
                            T1();

                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 testMap has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    private void testMap(Map<Key, String> m) {
                        while (true) {
                            for (int i = 0; i < 10000; i++) {
                                // 因此这个判断就失效了
                                if (!m.containsKey(new Key(i))) {
                Severity: Minor
                Found in class/src/main/java/jvm/oom/HeapOOM.java - About 25 mins to fix

                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 isNeedContinue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    private boolean isNeedContinue(List<Fraction> list) {
                        boolean flag = false;
                        for (Fraction b : list) {
                            if (b.isPositive()) {
                                flag = true;

                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

                Severity
                Category
                Status
                Source
                Language