skofgar/mercury

View on GitHub

Showing 577 of 821 total issues

Method fromMap has 85 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    Method onMessage has 84 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      Method onMessage has 84 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Method startHttpServerIfAny has 83 lines of code (exceeds 25 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) {

          Method getUrl has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

              private String getUrl(String url, boolean exact) {
                  StringBuilder sb = new StringBuilder();
                  List<String> parts = Utility.getInstance().split(url.toLowerCase(), "/");
                  for (String p: parts) {
                      String s = p.trim();

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

              private void scanLibInfo() {
                  if (!loaded) {
                      synchronized (ORDERLY_SCAN) {
                          List<String> list = new ArrayList<>();
                          for (String r : JAR_PATHS) {

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

              public byte[] stream2bytes(InputStream stream, boolean closeStream, int maxSize) {
                  if (stream == null) {
                      return new byte[0];
                  }
                  ByteArrayOutputStream out = new ByteArrayOutputStream();

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

              @Override
              public Object handleEvent(Map<String, String> headers, Object body, int instance) throws IOException {
                  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 checkServices has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

              @SuppressWarnings("unchecked")
              private boolean checkServices(List<Map<String, Object>> upstream, List<String> healthServices, boolean required) {
                  PostOffice po = PostOffice.getInstance();
                  boolean up = true;
                  for (String route: healthServices) {

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

              private String getNextAvailable(List<String> targetList) {
                  List<String> available = new ArrayList<>();
                  for (String target: targetList) {
                      if (ServiceRegistry.destinationExists(target)) {
                          available.add(target);

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

              @Override
              @SuppressWarnings("unchecked")
              public Object handleEvent(Map<String, String> headers, Object body, int instance) throws Exception {
                  if (INFO.equals(headers.get(TYPE))) {
                      Map<String, Object> result = 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

          Platform has 27 methods (exceeds 20 allowed). Consider refactoring.
          Open

          public class Platform {
              private static final Logger log = LoggerFactory.getLogger(Platform.class);
              private static final ManagedCache cache = ManagedCache.createCache("system.log.cache", 30000);
              private static final CryptoApi crypto = new CryptoApi();
              private static final ConcurrentMap<String, BlockingQueue<Boolean>> serviceTokens = new ConcurrentHashMap<>();

            Method handle has 79 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                @Override
                public void handle(HttpServerRequest request) {
                    PostOffice po = PostOffice.getInstance();
                    Utility util = Utility.getInstance();
                    HttpServerResponse response = request.response();

              File MonitorService.java has 298 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 sendRequestToService has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                Open

                    public void sendRequestToService(HttpServerRequest request, HttpRequestEvent requestEvent) {
                        SimpleHttpUtility httpUtil = SimpleHttpUtility.getInstance();
                        PostOffice po = PostOffice.getInstance();
                        if (requestEvent.authService != null) {
                            try {

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

                    @Override
                    public void handle(HttpServerRequest request) {
                        PostOffice po = PostOffice.getInstance();
                        Utility util = Utility.getInstance();
                        HttpServerResponse response = request.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 getTibcoProperties has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static synchronized Properties getTibcoProperties(String location) {
                        // default location is cloud.client.properties
                        Properties properties = allProperties.get(location);
                        if (properties == null) {
                            properties = new Properties();

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

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

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

                    public static Properties getClusterProperties(String location) {
                        // default location is cloud.client.properties
                        Properties properties = allProperties.get(location);
                        if (properties == null) {
                            ConfigReader clusterConfig = null;

                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 295 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