Kuangcp/JavaBase

View on GitHub

Showing 226 of 360 total issues

Method main has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static void main(String[] s) {
        String[] args = {"localhost", "10000"};
        String serverName = args[0];
        int port = Integer.parseInt(args[1]);

    Method expCalculate has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static BigDecimal expCalculate(Expression expression) {
            List<ExpressionWord> postfix = getPostfix(expression);  //获取表达式的后缀表达式
            Stack<BigDecimal> result = new Stack<>();  //操作数栈
            if (postfix != null && postfix.size() > 0) {
                for (int i = 0; i < postfix.size(); i++) {

      Method in has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        T in(Class<T> target, InputStream inputStream) {
          T object = null;
          try {
            Reader reader = new InputStreamReader(inputStream);
            BufferedReader bufferedReader = new BufferedReader(reader);

        Method getPostfix has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static List<ExpressionWord> getPostfix(Expression expression) {
                List<ExpressionWord> midfix = expression.getWord();  //获取中缀表达式的经过词法分析器分析的结果集
                List<ExpressionWord> result = new ArrayList<>();   //存储后缀表达式结果的List集合
                Stack<ExpressionWord> operationStack = new Stack<>();  //操作符栈
        
        

          Method doScanPackageClassesByFile has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private void doScanPackageClassesByFile(
                Set<Class<?>> classes,
                String packageName,
                String packagePath,
                final boolean recursive) {
          Severity: Minor
          Found in class/src/main/java/com/github/kuangcp/read/ClassScanner.java - About 1 hr to fix

            Method check has a Cognitive Complexity of 11 (exceeds 5 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--)
            Severity: Minor
            Found in gui/src/main/java/com/github/kuangcp/gomoku/CheckWin.java - About 1 hr 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 loopEventSpin has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                public static void loopEventSpin(String type, BlockingQueue<AbstractLoopEvent> queue) {
                    while (true) {
                        try {
                            final AbstractLoopEvent event = queue.take();
                            final long delay = event.getDelay(TimeUnit.MILLISECONDS);

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

              MythBaseStack<Integer> add(String one, String other) {
                boolean oneResult = initBigInteger(one, oneStack);
                boolean otherResult = initBigInteger(other, otherStack);
                if (!oneResult || !otherResult) {
                  return null;

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

              private void calculateResult(List<String> expression) {
                for (String row : expression) {
                  if (row.length() >= num) {
                    int temp = 0;
                    StringBuilder buffer = new StringBuilder();

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

              private void doScanPackageClassesByFile(
                  Set<Class<?>> classes,
                  String packageName,
                  String packagePath,
                  final boolean recursive) {
            Severity: Minor
            Found in class/src/main/java/com/github/kuangcp/read/ClassScanner.java - About 1 hr 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 match has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              public void match(String origin) {
                log.info("input string={}", origin);
                initBrackets();
            
                MythBaseStack<Integer> stack = new MythLinkedStack<>();

              Method main has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static void main(String[] args) throws InterruptedException {
                      log.info("start");
                      Thread sleep = new Thread(() -> {
                          while (true) {
                              try {
              Severity: Minor
              Found in concurrency/src/main/java/thread/InterruptHandleDemo.java - About 1 hr to fix

                Method transferOneKey has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  private void transferOneKey(String key, JedisPool originPool, JedisPool targetPool) {
                    try (Jedis originJedis = originPool.getResource()) {
                      originJedis.select(originDatabase);
                      String type = originJedis.type(key);
                      Optional<RedisDataType> dataType = RedisDataType.of(type);
                Severity: Minor
                Found in concurrency/src/main/java/redis/migration/Main.java - About 1 hr to fix

                  Method actionPerformed has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      @Override
                      public void actionPerformed(ActionEvent event) {
                          if (PlayStageMgr.stageNoneStart()) {
                              return;
                          }
                  Severity: Minor
                  Found in gui/src/main/java/com/github/kuangcp/tank/v3/SettingFrame.java - About 1 hr to fix

                    Method drawSelf has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public void drawSelf(Graphics g) {
                            //系统画图函数的参照点 (全是取的左上角)
                            int topX, topY;
                    
                            switch (direct) {
                    Severity: Minor
                    Found in gui/src/main/java/com/github/kuangcp/tank/domain/Tank.java - About 1 hr to fix

                      Method transferAllKey has 31 lines of code (exceeds 25 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 1 hr to fix

                        Method start has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public void start() {
                                master.execute(() -> {
                                    while (!stop) {
                                        long currentMills = System.currentTimeMillis();
                                        try {

                          Method execute has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              @Override
                              public List<R> execute(List<P> params, Function<P, R> handler) {
                                  List<R> results = Collections.synchronizedList(new ArrayList<>());
                          
                                  for (P p : params) {
                          Severity: Minor
                          Found in concurrency/src/main/java/situation/timoutpool/TimeoutExecPool.java - About 1 hr to fix

                            Method checkBong has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private void checkBong(Tank tank, Bullet bullet) {
                                    if (!bullet.alive || !tank.isAlive()) {
                                        return;
                                    }
                            
                            
                            Severity: Minor
                            Found in gui/src/main/java/com/github/kuangcp/tank/mgr/BombMgr.java - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language