skofgar/mercury

View on GitHub

Showing 821 of 821 total issues

Method startHttpServerIfAny has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    private void startHttpServerIfAny() throws IOException, InterruptedException {
        // find and execute optional preparation modules
        SimpleClassScanner scanner = SimpleClassScanner.getInstance();
        Set<String> packages = scanner.getPackages(true);
        for (String p : packages) {

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

    @Override
    public void onStartup(ServletContext servletContext) {
        if (!loaded) {
            // guarantee to do once
            loaded = 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

Method start has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    @SuppressWarnings("unchecked")
    public void start(String[] args) throws Exception {
        Platform platform = Platform.getInstance();
        String origin = platform.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 handleEvent has 121 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    @SuppressWarnings("unchecked")
    public Object handleEvent(Map<String, String> headers, Object body, int instance) throws Exception {

        Utility util = Utility.getInstance();

    File Platform.java has 366 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 toResponse has 119 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @Override
          public Response toResponse(Throwable exception) {
              if (template == null) {
                  template = util.stream2str(RestExceptionHandler.class.getResourceAsStream(TEMPLATE));
              }

        Method startConsumers has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

            private void startConsumers() throws IOException {
                if (topicPartition != null && topicPartition.contains("-")) {
                    AppConfigReader config = AppConfigReader.getInstance();
                    Platform platform = Platform.getInstance();
                    PostOffice po = PostOffice.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

        File ElasticQueue.java has 351 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

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

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

              private void sendEvent(String topic, int partition, Map<String, String> headers, Object body) {
                  String realTopic = partition < 0 ? topic : topic + "." + partition;
                  if (ConnectorConfig.topicSubstitutionEnabled()) {
                      realTopic = preAllocatedTopics.getOrDefault(realTopic, realTopic);
                  }
          connectors/adapters/tibco/tibco-connector/src/main/java/org/platformlambda/tibco/services/PubSubManager.java on lines 197..231

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

          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

              private void sendEvent(String topic, int partition, Map<String, String> headers, Object body) {
                  String realTopic = partition < 0 ? topic : topic + "." + partition;
                  if (ConnectorConfig.topicSubstitutionEnabled()) {
                      realTopic = preAllocatedTopics.getOrDefault(realTopic, realTopic);
                  }
          connectors/adapters/activemq/activemq-connector/src/main/java/org/platformlambda/activemq/services/PubSubManager.java on lines 196..230

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

          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

          File CryptoApi.java has 348 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 handleEvent has 108 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                @Override
                @SuppressWarnings("unchecked")
                public Object handleEvent(Map<String, String> headers, Object body, int instance) throws IOException {
                    PostOffice po = PostOffice.getInstance();
                    String rxPath, token, txPath;

              File TopicController.java has 344 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 run has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                Open

                        @Override
                        public void run() {
                            long t1 = 0;
                            long t2 = System.currentTimeMillis();
                            while (normal) {

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

                    public synchronized void startCloudServices() {
                        if (!Platform.cloudServicesStarted) {
                            // guarantee to execute once
                            Platform.cloudServicesStarted = true;
                            AppConfigReader reader = AppConfigReader.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 process has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                Open

                    public void process(EventEnvelope event) throws IOException {
                        /*
                         * The original sender is encoded in the extra field as a routing tag.
                         * It's value is in the format: "token_id->reply_to".
                         *

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

                    private List<String> getTopics() throws IOException {
                        Utility util = Utility.getInstance();
                        PubSub ps = PubSub.getInstance();
                        List<String> topics = ps.list();
                        if (topics.size() > 1) {

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

                    @Override
                    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
                        if (request instanceof HttpServletRequest && response instanceof HttpServletResponse) {
                            HttpServletRequest req = (HttpServletRequest) request;
                            HttpServletResponse res = (HttpServletResponse) response;

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

                    private int topicPartitions(String topic) throws Exception {
                        if (topicSubstitution) {
                            int n = 0;
                            while (preAllocatedTopics.containsKey(topic+"."+n)) {
                                n++;

                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 PubSubManager.java has 321 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

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