skofgar/mercury

View on GitHub

Showing 821 of 821 total issues

Avoid deeply nested control flow statements.
Open

                        if (partition < 0) {
                            log.info("Topic {} attached to {}", topic, existing.getRoutes());
                        } else {
                            log.info("Topic {} partition {} attached to {}", topic, partition, existing.getRoutes());
                        }

    Avoid deeply nested control flow statements.
    Open

                                    if (!preAllocatedTopics.containsKey(virtualTopic)) {
                                        throw new IOException("Missing topic substitution for "+virtualTopic);
                                    }

      Avoid deeply nested control flow statements.
      Open

                                  if (client != null) {
                                      notifyClient(client.getTxPath(), 200, route+" removed from network");
                                  }

        Avoid deeply nested control flow statements.
        Open

                                        if (!topicSubstitution) {
                                            // automatically create topic if not exist
                                            if (ps.exists(topic)) {
                                                int actualPartitions = ps.partitionCount(topic);
                                                if (actualPartitions < partitionCount) {

          Avoid deeply nested control flow statements.
          Open

                                      if (parts.size() == segments.size() + 1) {
                                          if (util.isDigits(parts.get(parts.size() - 1))) {
                                              n++;
                                          }
                                      }

            Avoid deeply nested control flow statements.
            Open

                                    if (topicPartition.contains("-")) {
                                        int separator = topicPartition.lastIndexOf('-');
                                        topic = topicPartition.substring(0, separator);
                                        partition = util.str2int(topicPartition.substring(separator + 1));
                                    } else {

              Method getTopicReplacement has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  private String getTopicReplacement(String virtualTopic) {
                      String replacement = preAllocatedTopics.get(virtualTopic);
                      if (replacement != null) {
                          return replacement;
                      }

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

                  private List<String> listTopics() throws Exception {
                      if (topicSubstitution) {
                          return new ArrayList<>(preAllocatedTopics.keySet());
                      }
                      List<String> result = new ArrayList<>();

              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 deeply nested control flow statements.
              Open

                                      for (String appOrigin: connectionList) {
                                          Object o = connections.get(appOrigin);
                                          String topic = TopicController.getTopic(appOrigin);
                                          if (topic != null && o instanceof Map) {
                                              Map<String, Object> metadata = (Map<String, Object>) o;

                Method updateInfo has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    private void updateInfo(Map<String, Object> info, Map<String, String> headers) {
                        Utility util = Utility.getInstance();
                        for (String key : headers.keySet()) {
                            if (!key.equals(ID) && !key.equals(MONITOR)) {
                                // normalize numbers

                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 deeply nested control flow statements.
                Open

                                            if (now - activeTopics.get(t) > EXPIRY) {
                                                activeTopics.remove(t);
                                                topicStore.put(t, AVAILABLE);
                                                log.info("{} expired", t);
                                            }

                  Avoid deeply nested control flow statements.
                  Open

                                              if (pc != null) {
                                                  pendingConnections.put(route, pc.setType(PendingConnection.PendingType.HANDSHAKE));
                                                  log.info("Member registered {} {}", md.origin, info.get(NAME));
                                                  po.send(MainApp.TOPIC_CONTROLLER, new Kv(TYPE, GET_TOPIC),
                                                          new Kv(TX_PATH, md.txPath), new Kv(ORIGIN, md.origin));

                    Avoid deeply nested control flow statements.
                    Open

                                                if (Platform.getInstance().hasRoute(route) && !routingTable.containsKey(route)) {
                                                    notifyClient(client.getTxPath(), 409,
                                                            "Unable to advertise " + route + " because route is reserved");
                                                } else {
                                                    if (!routingTable.containsKey(route)) {

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                          public boolean rsaVerify(byte[] data, byte[] signature, byte[] publicKey) throws GeneralSecurityException {
                              PublicKey key = getPublic(publicKey, true);
                              Signature dsa = Signature.getInstance(SHA1_RSA);
                              dsa.initVerify(key);
                              dsa.update(data);
                      system/platform-core/src/main/java/org/platformlambda/core/util/CryptoApi.java on lines 240..246

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 54.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                          public boolean dsaVerify(byte[] data, byte[] signature, byte[] publicKey) throws GeneralSecurityException {
                              PublicKey key = getPublic(publicKey, false);
                              Signature dsa = Signature.getInstance(SHA1_DSA);
                              dsa.initVerify(key);
                              dsa.update(data);
                      system/platform-core/src/main/java/org/platformlambda/core/util/CryptoApi.java on lines 193..199

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 54.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 4 locations. Consider refactoring.
                      Open

                      /*
                      
                          Copyright 2018-2023 Accenture Technology
                      
                          Licensed under the Apache License, Version 2.0 (the "License");
                      benchmark/benchmark-client/src/main/java/com/accenture/benchmark/MainApp.java on lines 1..54
                      benchmark/benchmark-server/src/main/java/com/accenture/benchmark/MainApp.java on lines 1..54
                      benchmark/benchmark-standalone/src/main/java/com/accenture/benchmark/MainApp.java on lines 1..54

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 53.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 4 locations. Consider refactoring.
                      Open

                      /*
                      
                          Copyright 2018-2023 Accenture Technology
                      
                          Licensed under the Apache License, Version 2.0 (the "License");
                      benchmark/benchmark-server/src/main/java/com/accenture/benchmark/MainApp.java on lines 1..54
                      benchmark/benchmark-standalone/src/main/java/com/accenture/benchmark/MainApp.java on lines 1..54
                      examples/rest-automation-app/src/main/java/com/accenture/automation/RestAutomation.java on lines 1..54

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 53.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 4 locations. Consider refactoring.
                      Open

                      /*
                      
                          Copyright 2018-2023 Accenture Technology
                      
                          Licensed under the Apache License, Version 2.0 (the "License");
                      benchmark/benchmark-client/src/main/java/com/accenture/benchmark/MainApp.java on lines 1..54
                      benchmark/benchmark-server/src/main/java/com/accenture/benchmark/MainApp.java on lines 1..54
                      examples/rest-automation-app/src/main/java/com/accenture/automation/RestAutomation.java on lines 1..54

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 53.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                      /*
                      
                          Copyright 2018-2023 Accenture Technology
                      
                          Licensed under the Apache License, Version 2.0 (the "License");
                      examples/rest-example/src/main/java/org/platformlambda/models/ObjectWithGenericType.java on lines 1..42

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 53.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                      /*
                      
                          Copyright 2018-2023 Accenture Technology
                      
                          Licensed under the Apache License, Version 2.0 (the "License");
                      examples/lambda-example/src/main/java/org/platformlambda/models/ObjectWithGenericType.java on lines 1..42

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 53.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Severity
                      Category
                      Status
                      Source
                      Language