skofgar/mercury

View on GitHub

Showing 821 of 821 total issues

Method handleEvent has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    public Object handleEvent(Map<String, String> headers, Object body, int instance) throws Exception {
        if (headers.containsKey(TO) && body instanceof byte[]) {
            List<String> destinations = getDestinations(headers);
            if (!destinations.isEmpty()) {

    Identical blocks of code found in 4 locations. Consider refactoring.
    Open

        @Override
        public int partitionCount(String topic) throws IOException {
            try {
                EventEnvelope response = PostOffice.getInstance().request(cloudManager, 20000,
                        new Kv(TYPE, PARTITIONS), new Kv(TOPIC, topic));
    connectors/adapters/activemq/activemq-connector/src/main/java/org/platformlambda/activemq/services/PubSubManager.java on lines 308..321
    connectors/adapters/kafka/kafka-connector/src/main/java/org/platformlambda/kafka/services/PubSubManager.java on lines 202..215
    connectors/adapters/tibco/tibco-connector/src/main/java/org/platformlambda/tibco/services/PubSubManager.java on lines 302..315

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 74.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 4 locations. Consider refactoring.
    Open

        @Override
        public int partitionCount(String topic) throws IOException {
            try {
                EventEnvelope response = PostOffice.getInstance().request(cloudManager, 20000,
                                            new Kv(TYPE, PARTITIONS), new Kv(TOPIC, topic));
    connectors/adapters/activemq/activemq-connector/src/main/java/org/platformlambda/activemq/services/PubSubManager.java on lines 308..321
    connectors/adapters/hazelcast/hazelcast-connector/src/main/java/org/platformlambda/hazelcast/services/PubSubManager.java on lines 253..266
    connectors/adapters/tibco/tibco-connector/src/main/java/org/platformlambda/tibco/services/PubSubManager.java on lines 302..315

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 74.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 4 locations. Consider refactoring.
    Open

        @Override
        public int partitionCount(String topic) throws IOException {
            try {
                EventEnvelope response = PostOffice.getInstance().request(cloudManager, 20000,
                        new Kv(TYPE, PARTITIONS), new Kv(TOPIC, topic));
    connectors/adapters/activemq/activemq-connector/src/main/java/org/platformlambda/activemq/services/PubSubManager.java on lines 308..321
    connectors/adapters/hazelcast/hazelcast-connector/src/main/java/org/platformlambda/hazelcast/services/PubSubManager.java on lines 253..266
    connectors/adapters/kafka/kafka-connector/src/main/java/org/platformlambda/kafka/services/PubSubManager.java on lines 202..215

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 74.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 4 locations. Consider refactoring.
    Open

        @Override
        public int partitionCount(String topic) throws IOException {
            try {
                EventEnvelope response = PostOffice.getInstance().request(cloudManager, 20000,
                        new Kv(TYPE, PARTITIONS), new Kv(TOPIC, topic));
    connectors/adapters/hazelcast/hazelcast-connector/src/main/java/org/platformlambda/hazelcast/services/PubSubManager.java on lines 253..266
    connectors/adapters/kafka/kafka-connector/src/main/java/org/platformlambda/kafka/services/PubSubManager.java on lines 202..215
    connectors/adapters/tibco/tibco-connector/src/main/java/org/platformlambda/tibco/services/PubSubManager.java on lines 302..315

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 74.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                connection.setExceptionListener((e) -> {
                    String error = e.getMessage();
                    log.error("Activemq cluster exception - {}", error);
                    if (error != null && (error.contains("terminated") || error.contains("disconnect"))) {
                        ArtemisConnector.stopConnection(domain);
    connectors/adapters/tibco/tibco-connector/src/main/java/org/platformlambda/tibco/TibcoConnector.java on lines 144..151

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 74.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                connection.setExceptionListener((e) -> {
                    String error = e.getMessage();
                    log.error("Tibco cluster exception - {}", error);
                    if (error != null && (error.contains("terminated") || error.contains("disconnect"))) {
                        TibcoConnector.stopConnection(domain);
    connectors/adapters/activemq/activemq-connector/src/main/java/org/platformlambda/activemq/ArtemisConnector.java on lines 116..123

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 74.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Method getRouteInfo has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public AssignedRoute getRouteInfo(String method, String url) {
            Utility util = Utility.getInstance();
            StringBuilder sb = new StringBuilder();
            List<String> input = util.split(url, "/");
            for (String p: input) {

      Method register has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @SuppressWarnings("rawtypes")
          private void register(String route, TypedLambdaFunction lambda, boolean isPrivate, int instances)
                  throws IOException {
              if (lambda == null) {
                  throw new IOException("Missing lambda function");

        Method loadMulticast has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @SuppressWarnings("unchecked")
            private void loadMulticast(Map<String, Object> map) {
                Set<String> list = new HashSet<>();
                Platform platform = Platform.getInstance();
                MultiLevelMap multi = new MultiLevelMap(map);

          Method suspendResume has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private void suspendResume(HttpServerResponse response, String uri, String origin) {
                  if (origin == null) {
                      sendError(response, uri, 400, "Missing "+ APP_INSTANCE +" in request header");
                      return;
                  }

            Method getBody has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                @SuppressWarnings("unchecked")
                public Object getBody() {
                    if (!encoded) {
                        if (type == null) {
                            setBody(body);

              Method registerStream has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private void registerStream(String route, StreamFunction lambda, boolean isPrivate) throws IOException {
                      if (lambda == null) {
                          throw new IOException("Missing lambda function");
                      }
                      String path = getValidatedRoute(route);

                Method handleEvent has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        @Override
                        public Object handleEvent(Map<String, String> headers, Object body, int instance) {
                            if (body instanceof String && db != null && dbEnv != null) {
                                Utility util = Utility.getInstance();
                                int n = 0;

                  Method getClient has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static synchronized HazelcastInstance getClient(String domain, Properties properties) {
                          HazelcastInstance client = allClients.get(domain);
                          if (client == null) {
                              Utility util = Utility.getInstance();
                              String url = properties.getProperty(BROKER_URL);

                    Method getReplicationFactor has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private int getReplicationFactor() {
                            if (topicSubstitution) {
                                return 1;
                            }
                            if (replicationFactor == -1) {

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

                          private int topicPartitions(String topic) throws TibjmsAdminException {
                              if (topicSubstitution) {
                                  int n = 0;
                                  while (preAllocatedTopics.containsKey(topic+"."+n)) {
                                      n++;

                        Identical blocks of code found in 4 locations. Consider refactoring.
                        Open

                            @Override
                            public boolean exists(String topic) throws IOException {
                                try {
                                    EventEnvelope response = PostOffice.getInstance().request(cloudManager, 20000,
                                            new Kv(TYPE, EXISTS), new Kv(TOPIC, topic));
                        connectors/adapters/activemq/activemq-connector/src/main/java/org/platformlambda/activemq/services/PubSubManager.java on lines 293..306
                        connectors/adapters/kafka/kafka-connector/src/main/java/org/platformlambda/kafka/services/PubSubManager.java on lines 187..200
                        connectors/adapters/tibco/tibco-connector/src/main/java/org/platformlambda/tibco/services/PubSubManager.java on lines 287..300

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 72.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                                    if (CREATE.equals(headers.get(TYPE)) && headers.containsKey(TOPIC)) {
                                        int partitions = headers.containsKey(PARTITIONS)?
                                                            Math.max(1, Utility.getInstance().str2int(headers.get(PARTITIONS))) : 1;
                                        createTopic(headers.get(TOPIC), partitions);
                                        return true;
                        connectors/adapters/kafka/kafka-connector/src/main/java/org/platformlambda/kafka/services/TopicManager.java on lines 107..112

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 72.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                                    if (value == null) {
                                        v = "";
                                    } else if (value instanceof String) {
                                        v = (String) value;
                                    } else if (value instanceof Date) {
                        system/platform-core/src/main/java/org/platformlambda/core/models/EventEnvelope.java on lines 502..510

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 72.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Severity
                        Category
                        Status
                        Source
                        Language