skofgar/mercury

View on GitHub

Showing 821 of 821 total issues

Method loadRestEntry has a Cognitive Complexity of 171 (exceeds 5 allowed). Consider refactoring.
Open

    @SuppressWarnings("unchecked")
    private void loadRestEntry(Map<String, Object> entry, boolean exact) {
        Utility util = Utility.getInstance();
        RouteInfo info = new RouteInfo();
        if ((entry.get(SERVICE) instanceof String || entry.get(SERVICE) instanceof List) &&

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

    @Override
    public Object handleEvent(Map<String, String> headers, Object body, int instance) throws Exception {
        Utility util = Utility.getInstance();
        AsyncHttpRequest request = new AsyncHttpRequest(body);
        String targetHost = request.getTargetHost();

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

/*

    Copyright 2018-2023 Accenture Technology

    Licensed under the Apache License, Version 2.0 (the "License");
connectors/adapters/tibco/tibco-connector/src/main/java/org/platformlambda/tibco/services/EventConsumer.java on lines 1..244

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

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");
connectors/adapters/activemq/activemq-connector/src/main/java/org/platformlambda/activemq/services/EventConsumer.java on lines 1..245

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

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

Method handleEvent has a Cognitive Complexity of 140 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    @SuppressWarnings("unchecked")
    public Object handleEvent(Map<String, String> headers, Object body, int instance) throws IOException {
        Platform platform = Platform.getInstance();
        String myOrigin = 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 a Cognitive Complexity of 119 (exceeds 5 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;

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 117 (exceeds 5 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;

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

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

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

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

        Utility util = Utility.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 Utility.java has 854 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*

    Copyright 2018-2023 Accenture Technology

    Licensed under the Apache License, Version 2.0 (the "License");

    File PostOffice.java has 819 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 routeRequest has a Cognitive Complexity of 95 (exceeds 5 allowed). Consider refactoring.
      Open

          private void routeRequest(String requestId, AssignedRoute route, AsyncContextHolder holder) throws AppException {
              Utility util = Utility.getInstance();
              HttpServerRequest request = holder.request;
              String uri = util.getUrlDecodedPath(request.path());
              String method = request.method().name();

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

              @SuppressWarnings({"rawtypes", "unchecked"})
              private ProcessStatus processEvent(EventEnvelope event) {
                  ProcessStatus ps = new ProcessStatus();
                  PostOffice po = PostOffice.getInstance();
                  Map<String, Object> inputOutput = 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 RoutingEntry.java has 676 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

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

        Utility has 76 methods (exceeds 20 allowed). Consider refactoring.
        Open

        public class Utility {
            private static final Logger log = LoggerFactory.getLogger(Utility.class);
        
            private static final ConcurrentMap<Long, List<String>> TEMP_CONFIG = new ConcurrentHashMap<>();
            public static final String ISO_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ssZ";

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

                  @Override
                  public void run() {
                      log.info("RSVP processor started");
                      Runtime.getRuntime().addShutdownHook(new Thread(this::shutdown));
          
          

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

              private void routeRequest(String requestId, AssignedRoute route, AsyncContextHolder holder) throws AppException {
                  Utility util = Utility.getInstance();
                  HttpServerRequest request = holder.request;
                  String uri = util.getUrlDecodedPath(request.path());
                  String method = request.method().name();

            Method initialize has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
            Open

                public static void initialize() throws IOException {
                    if (apiKey == null) {
                        apiKey = getApiKey();
                        log.info("Started");
                        LambdaFunction registry = (headers, body, instance) -> {

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

            /*
                Copyright 2018-2023 Accenture Technology
                Licensed under the Apache License, Version 2.0 (the "License");
                you may not use this file except in compliance with the License.
                You may obtain a copy of the License at

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

                  @Override
                  public Object handleEvent(Map<String, String> headers, Object body, int instance) throws Exception {
                      Utility util = Utility.getInstance();
                      AsyncHttpRequest request = new AsyncHttpRequest(body);
                      String targetHost = request.getTargetHost();
                Severity
                Category
                Status
                Source
                Language