skofgar/mercury

View on GitHub

Showing 821 of 821 total issues

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

    @SuppressWarnings("unchecked")
    @Override
    public Object handleEvent(Map<String, String> headers, Object body, int instance) throws IOException {
        PostOffice po = PostOffice.getInstance();
        String myOrigin = 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

File ServiceGateway.java has 526 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 load has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
    Open

        @SuppressWarnings("unchecked")
        public void load(byte[] bytes) throws IOException {
            Object o = msgPack.unpack(bytes);
            if (o instanceof Map) {
                Map<String, Object> message = (Map<String, Object>) o;

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

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

      EventEnvelope has 57 methods (exceeds 20 allowed). Consider refactoring.
      Open

      public class EventEnvelope {
          private static final Logger log = LoggerFactory.getLogger(EventEnvelope.class);
      
          private static final MsgPack msgPack = new MsgPack();
          private static final PayloadMapper converter = PayloadMapper.getInstance();

        Method load has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
        Open

            @SuppressWarnings("unchecked")
            public void load(ConfigReader config) {
                if (config.exists(HEADERS)) {
                    Object headerList = config.get(HEADERS);
                    if (headerList 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 loadRestEntry has 202 lines of code (exceeds 25 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) &&

          File LanguageConnector.java has 502 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

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

            AsyncHttpRequest has 56 methods (exceeds 20 allowed). Consider refactoring.
            Open

            public class AsyncHttpRequest {
            
                private static final PayloadMapper converter = PayloadMapper.getInstance();
                private static final String HTTP_HEADERS = "headers";
                private static final String HTTP_METHOD = "method";

              PostOffice has 55 methods (exceeds 20 allowed). Consider refactoring.
              Open

              public class PostOffice {
                  private static final Logger log = LoggerFactory.getLogger(PostOffice.class);
              
                  public static final int ONE_MILLISECOND = 1000000;
                  public static final String CLOUD_CONNECTOR = "cloud.connector";

                Method onStartup has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
                Open

                    @Override
                    public void onStartup(ServletContext context) {
                
                        SimpleClassScanner scanner = SimpleClassScanner.getInstance();
                        Set<String> packages = scanner.getPackages(false);

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

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

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

                    public void validateCompositePathSyntax(String path) {
                        Utility util = Utility.getInstance();
                        List<String> segments = util.split(path, "./");
                        if (segments.isEmpty()) {
                            throw new IllegalArgumentException("Missing composite 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 onMessage has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
                Open

                        @SuppressWarnings("unchecked")
                        @Override
                        public void onMessage(Message<Map<String, Object>> evt) {
                            Utility util = Utility.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

                Method handleEvent has 178 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 {
                        Platform platform = Platform.getInstance();
                        String myOrigin = platform.getOrigin();

                  Method processEvent has 175 lines of code (exceeds 25 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<>();

                    Method handle has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
                    Open

                            @Override
                            public void handle(Message<Object> message) {
                                Object body = message.body();
                                if (body instanceof String) {
                                    String text = (String) 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 fromMap has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
                    Open

                        @SuppressWarnings("unchecked")
                        private void fromMap(Object input) {
                            if (input instanceof AsyncHttpRequest) {
                                AsyncHttpRequest source = (AsyncHttpRequest) input;
                                this.headers = source.headers;

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

                        @Override
                        public Object handleEvent(Map<String, String> headers, Object body, int instance) throws Exception {
                            Utility util = Utility.getInstance();
                            PostOffice po = PostOffice.getInstance();
                            String myOrigin = 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 getDestinations has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
                    Open

                        @SuppressWarnings("unchecked")
                        private List<String> getDestinations(Map<String, String> headers) {
                            String to = headers.get(TO);
                            boolean broadcast = headers.containsKey(BROADCAST);
                            String id = headers.get(ID);

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language