skofgar/mercury

View on GitHub

Showing 821 of 821 total issues

Method getKafkaProperties has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    Method handleBytes has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private void handleBytes(Map<String, String> headers, byte[] payload) throws IOException {
            String route = headers.get(WsEnvelope.ROUTE);
            PostOffice po = PostOffice.getInstance();
            WsMetadata md = connections.get(route);
            if (md != null) {

      Method loadCorsEntry has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          @SuppressWarnings("unchecked")
          private void loadCorsEntry(String id, String origin, Object options, Object headers) {
              if (options instanceof List && headers instanceof List) {
                  List<Object> optionList = (List<Object>) options;
                  List<Object> headerList = (List<Object>) 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 12 (exceeds 5 allowed). Consider refactoring.
      Open

              @Override
              public Object handleEvent(Map<String, String> headers, Object body, int instance) throws Exception {
                  Platform platform = Platform.getInstance();
                  PostOffice po = PostOffice.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 12 (exceeds 5 allowed). Consider refactoring.
      Open

          @Override
          public void run() {
              log.info("Async HTTP timeout handler started");
              while (normal) {
                  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 handleEvent has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

              @Override
              public void handleEvent(Map<String, String> headers, Object body) throws Exception {
                  if (DATA.equals(headers.get(TYPE))) {
                      if (!eof.get()) {
                          String cb = callbacks.poll();

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

          @SuppressWarnings("unchecked")
          private void appendNode(StringBuilder buffer, String nodeName, Object value, int indent) {
              // Skip null value
              if (value == null) {
                  return;

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

          private static boolean kafkaReachable(List<String> brokers, int tries) throws IOException {
              for (String dest: brokers) {
                  if (dest.contains(":")) {
                      Utility util = Utility.getInstance();
                      int colon = dest.indexOf(':');

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

          private void sendAppInfo(long n, boolean alive) {
              if (monitor != null) {
                  try {
                      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 send has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          private void send(String token, EventEnvelope event) throws IOException {
              String txPath = LanguageConnector.getTxPathFromToken(token);
              if (txPath != null) {
                  if (event.getBroadcastLevel() == 2) {
                      event.setBroadcastLevel(3);

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

          @SuppressWarnings("unchecked")
          private void handleClose(Map<String, String> headers) throws IOException {
              String route = headers.get(WsEnvelope.ROUTE);
              PostOffice po = PostOffice.getInstance();
              WsMetadata md = connections.get(route);

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

          @Override
          public Object handleEvent(Map<String, String> headers, Object body, int instance) throws Exception {
              EventEnvelope event = (EventEnvelope) body;
              String to = event.getTo();
              if (to != 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 hello has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @GET
          @Path("/concurrent")
          @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.TEXT_HTML})
          public void hello(@Context HttpServletRequest request,
                                           @Suspended AsyncResponse response) throws IOException {

        Method sendRequestToService has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Method hello has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              @GET
              @Path("/concurrent")
              @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.TEXT_HTML})
              public Map<String, Object> hello(@Context HttpServletRequest request) throws IOException, AppException {
          
          

            Method str2date has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public Date str2date(String str, boolean throwException) {
                    if (isDigits(str)) {
                        return new Date(Long.parseLong(str));
                    }
                    /*

              Method stream2bytes has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

                Method getVirtualTopics has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    @SuppressWarnings("unchecked")
                    private List<String> getVirtualTopics(Map<String, Object> connections) {
                        Map<String, String> topics = TopicController.getAssignedTopics();
                        Map<String, List<String>> members = new HashMap<>();
                        for (String t: topics.keySet()) {

                  Method getTopicSubstitution has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static Map<String, String> getTopicSubstitution() throws IOException {
                          if (topicReplacements == null) {
                              Utility util = Utility.getInstance();
                              Map<String, String> result = new HashMap<>();
                              AppConfigReader config = AppConfigReader.getInstance();

                    Method topicPartitions has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private int topicPartitions(String topic) throws Exception {
                            if (topicSubstitution) {
                                int n = 0;
                                while (preAllocatedTopics.containsKey(topic+"."+n)) {
                                    n++;
                      Severity
                      Category
                      Status
                      Source
                      Language