skofgar/mercury

View on GitHub

Showing 577 of 821 total issues

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

          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 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 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));
                      }
                Severity
                Category
                Status
                Source
                Language