Kuangcp/JavaBase

View on GitHub
question/src/main/java/com/github/kuangcp/simplex/method/SimplexMethodWithFraction.java

Summary

Maintainability
D
2 days
Test Coverage

Method maxList has a Cognitive Complexity of 44 (exceeds 5 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<>();

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

File SimplexMethodWithFraction.java has 288 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package com.github.kuangcp.simplex.method;

import com.github.kuangcp.math.number.Fraction;
import lombok.extern.slf4j.Slf4j;

    Method run has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        public void run() throws Exception {
            init();
    //运算出初始的表格
            display("中间计算结果", Tables);
            //计算最底下一行

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

        private void showRows() {
            StringBuilder MaxRows = new StringBuilder("Max(z)=");
            for (int i = 0; i < MAX_PARAMS; i++) {
                if (!Max.get(i).isZero()) {
                    MaxRows.append(Max.get(i)).append(" X").append(i + 1).append(" + ");

    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 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public void run() throws Exception {
            init();
    //运算出初始的表格
            display("中间计算结果", Tables);
            //计算最底下一行

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

            private void finallyResult() throws Exception {
                Integer RightMin = maxList(Os, false, true, false);
                boolean SUCCESS = true;
                if (RightMin == -1) {
                    System.out.println("右列没有一个正数,最后一行也没有正数,原方程没有最优解");

        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 finallyResult has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private void finallyResult() throws Exception {
                Integer RightMin = maxList(Os, false, true, false);
                boolean SUCCESS = true;
                if (RightMin == -1) {
                    System.out.println("右列没有一个正数,最后一行也没有正数,原方程没有最优解");

          Method showRows has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private void showRows() {
                  StringBuilder MaxRows = new StringBuilder("Max(z)=");
                  for (int i = 0; i < MAX_PARAMS; i++) {
                      if (!Max.get(i).isZero()) {
                          MaxRows.append(Max.get(i)).append(" X").append(i + 1).append(" + ");

            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 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 + " :    ");

              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

              There are no issues that match your filters.

              Category
              Status