skofgar/mercury

View on GitHub

Showing 821 of 821 total issues

Method run has 156 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    public void run() {
        final boolean requireInitialization = offset == INITIALIZE;
        if (requireInitialization) {
            /*

    Method handleEvent has 155 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @Override
        public Object handleEvent(Map<String, String> headers, Object body, int instance) {
            Utility util = Utility.getInstance();
            SimpleHttpUtility httpUtil = SimpleHttpUtility.getInstance();
            EventEnvelope event = (EventEnvelope) body;

      File HttpRelay.java has 422 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*
      
          Copyright 2018-2023 Accenture Technology
      
          Licensed under the Apache License, Version 2.0 (the "License");

        Method getElement has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
        Open

            @SuppressWarnings("unchecked")
            private Object getElement(String path, Map<String, Object> map) {
                if (path == null || map == null || map.isEmpty()) return null;
                if (map.containsKey(path)) {
                    return map.get(path);

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

            @SuppressWarnings("unchecked")
            private void setElement(String path, Object value, Map<String, Object> map, boolean delete) {
                Utility util = Utility.getInstance();
                List<String> segments = util.split(path, "./");
                if (segments.isEmpty()) {

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

            @SuppressWarnings({ "unchecked", "rawtypes" })
            private MessagePacker pack(MessagePacker packer, Object o) throws IOException {
                if (o == null) {
                    // preserving null element in an array list
                    packer.packNil();

        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

        CryptoApi has 44 methods (exceeds 20 allowed). Consider refactoring.
        Open

        public class CryptoApi {
        
            public static final String PUBLIC = ".pub";
            public static final String PRIVATE = ".key";
            private static final int IV_LENGTH = 16;

          File ServiceRegistry.java has 415 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /*
          
              Copyright 2018-2023 Accenture Technology
          
              Licensed under the Apache License, Version 2.0 (the "License");

            Method onMessage has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
            Open

                    @SuppressWarnings("unchecked")
                    @Override
                    public void onMessage(Message evt) {
                        PostOffice po = PostOffice.getInstance();
                        String origin = Platform.getInstance().getOrigin();

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

                private void parseXML(Map<String, Map<String, Integer>> childMap,
                                      List<List<String>> kvList, Node node, String parent) {
            
                    String parentPath = normalizeParentPath(parent);
                    if (node.getNodeType() == Node.TEXT_NODE) {

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

                    @SuppressWarnings("unchecked")
                    @Override
                    public void onMessage(Message evt) {
                        PostOffice po = PostOffice.getInstance();
                        String origin = Platform.getInstance().getOrigin();

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

                @SuppressWarnings("rawtypes")
                private void loadServices() {
                    log.info("Preloading started");
                    Utility util = Utility.getInstance();
                    Platform platform = Platform.getInstance();

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

                private void makeConnection(int idleSeconds) {
                    if (!running) {
                        return;
                    }
                    if (urls.isEmpty()) {

              Method send has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
              Open

                  public void send(final EventEnvelope event) throws IOException {
                      String dest = event.getTo();
                      if (dest == null) {
                          throw new IllegalArgumentException(MISSING_ROUTING_PATH);
                      }

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

                  @Override
                  public Object handleEvent(Map<String, String> headers, Object body, int instance) throws Exception {
                      if (headers.containsKey(TYPE)) {
                          if (LIST.equals(headers.get(TYPE))) {
                              return listTopics();

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

                  @Override
                  public Object handleEvent(Map<String, String> headers, Object body, int instance) throws Exception {
                      if (headers.containsKey(TYPE)) {
                          if (LIST.equals(headers.get(TYPE))) {
                              return listTopics();

              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

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

                  @Override
                  public Object handleEvent(Map<String, String> headers, Object body, int instance) throws Exception {
                      if (headers.containsKey(TYPE)) {
                          if (LIST.equals(headers.get(TYPE))) {
                              return listTopics();
              connectors/adapters/activemq/activemq-connector/src/main/java/org/platformlambda/activemq/services/TopicManager.java on lines 75..118

              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 312.

              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

                  @Override
                  public Object handleEvent(Map<String, String> headers, Object body, int instance) throws Exception {
                      if (headers.containsKey(TYPE)) {
                          if (LIST.equals(headers.get(TYPE))) {
                              return listTopics();
              connectors/adapters/tibco/tibco-connector/src/main/java/org/platformlambda/tibco/services/TopicManager.java on lines 57..100

              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 312.

              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

                  @Override
                  public void publish(String topic, int partition, Map<String, String> headers, Object body) throws IOException {
                      ConnectorConfig.validateTopicName(topic);
                      Map<String, String> eventHeaders = headers == null? new HashMap<>() : headers;
                      if (eventHeaders.containsKey(EventProducer.EMBED_EVENT) && body instanceof byte[]) {
              connectors/adapters/tibco/tibco-connector/src/main/java/org/platformlambda/tibco/services/PubSubManager.java on lines 158..195

              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 311.

              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

                  @Override
                  public void publish(String topic, int partition, Map<String, String> headers, Object body) throws IOException {
                      ConnectorConfig.validateTopicName(topic);
                      Map<String, String> eventHeaders = headers == null? new HashMap<>() : headers;
                      if (eventHeaders.containsKey(EventProducer.EMBED_EVENT) && body instanceof byte[]) {
              connectors/adapters/activemq/activemq-connector/src/main/java/org/platformlambda/activemq/services/PubSubManager.java on lines 157..194

              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 311.

              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