skofgar/mercury

View on GitHub

Showing 821 of 821 total issues

Avoid deeply nested control flow statements.
Open

                            for (Object block : in) {
                                // update last access time
                                holder.touch();
                                /*
                                 * only bytes or text are supported when using output stream

    Method readFrom has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public T readFrom(Class<T> type, Type genericType, Annotation[] annotations, MediaType mediaType,
                          MultivaluedMap<String, String> httpHeaders, InputStream entityStream)

      Avoid deeply nested control flow statements.
      Open

                              if (svc != null) {
                                  authService = svc;
                                  break;
                              }

        Avoid deeply nested control flow statements.
        Open

                                    if (!Utility.getInstance().validServiceName(annotation.value())) {
                                        log.error("Unable to load {} ({}) because the path is not a valid service name",
                                                cls.getName(), annotation.value());
                                    }

          Method waitForProvider has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public void waitForProvider(int seconds) {
                  int waitSeconds = Math.max(1, seconds);
                  int n = 0;
                  while (provider == null && waitSeconds > 0) {
                      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

          Avoid deeply nested control flow statements.
          Open

                                  if (!exactRoutes.containsKey(urlOnly) && !urlPaths.contains(urlOnly)) {
                                      urlPaths.add(urlOnly);
                                  }

            Method request has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public EventEnvelope request(String to, long timeout, Object body, Kv... parameters) throws IOException, TimeoutException, AppException {
                    EventEnvelope event = new EventEnvelope().setTo(to).setBody(body);
                    if (parameters != null) {
                        for (Kv kv: parameters) {
                            if (kv.key != null && kv.value != 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

            Method sendLater has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public String sendLater(final EventEnvelope event, Date future) {
                    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

            Avoid deeply nested control flow statements.
            Open

                                    if (start) {
                                        throw new IllegalArgumentException("Invalid composite path - missing end bracket");
                                    } else {
                                        start = true;
                                    }

              Avoid deeply nested control flow statements.
              Open

                                          if (!md.getWebSocket().isClosed()) {
                                              md.getWebSocket().close((short) 1003, "Idle for " + timeout + " seconds");
                                          }

                Avoid deeply nested control flow statements.
                Open

                                        if (loaded.contains(name)) {
                                            log.error("Cloud service ({}) already loaded", name);
                                        } else {
                                            if (startService(name, services, false)) {
                                                loaded.add(name);

                  Method getError has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public String getError() {
                          if (hasError()) {
                              // body is used to store error message if status is not 200
                              if (body == null) {
                                  return "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

                  Avoid deeply nested control flow statements.
                  Open

                                              if (name.startsWith("je.stat.") && name.endsWith(".csv")
                                                      && !name.equals("je.stat.csv") && now - f.lastModified() > ONE_DAY) {
                                                  outdated.add(f);
                                              }

                    Method shutdown has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private static void shutdown() {
                            if (alive != null) {
                                alive.shutdown();
                                try {
                                    db.close();

                    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

                    Avoid deeply nested control flow statements.
                    Open

                                            if (n == len) {
                                                return next;
                                            }

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

                              @Override
                              public void run() {
                                  log.info("Started");
                                  long t1 = 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 run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                              @Override
                              public void run() {
                                  log.info("Started");
                                  long t1 = 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 request has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public EventEnvelope request(String to, long timeout, Kv... parameters) throws IOException, TimeoutException, AppException {
                              EventEnvelope event = new EventEnvelope().setTo(to);
                              if (parameters != null) {
                                  for (Kv kv: parameters) {
                                      if (kv.key != null && kv.value != 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

                      Avoid deeply nested control flow statements.
                      Open

                                                      if (p.containsKey(GROUP_ID) && p.containsKey(ARTIFACT_ID) &&
                                                              p.containsKey(VERSION) && name.equals(p.getProperty(ARTIFACT_ID))) {
                                                              versionInfo.setGroupId(p.getProperty(GROUP_ID))
                                                                          .setVersion(p.getProperty(VERSION));
                                                      }

                        Avoid deeply nested control flow statements.
                        Open

                                                if (next instanceof Map) {
                                                    current = (Map<String, Object>) next;
                                                    continue;
                                                }
                          Severity
                          Category
                          Status
                          Source
                          Language