skofgar/mercury

View on GitHub

Showing 821 of 821 total issues

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

                executor.submit(() -> {
                    PostOffice po = PostOffice.getInstance();
                    String traceLogHeader = po.getTraceLogHeader();
                    po.startTracing(sender, reply.getTraceId(), reply.getTracePath());
                    if (reply.getTraceId() != null) {
system/platform-core/src/main/java/org/platformlambda/core/models/AsyncMultiInbox.java on lines 131..141

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 94.

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

                    executor.submit(() -> {
                        PostOffice po = PostOffice.getInstance();
                        String traceLogHeader = po.getTraceLogHeader();
                        po.startTracing(sender, reply.getTraceId(), reply.getTracePath());
                        if (reply.getTraceId() != null) {
system/platform-core/src/main/java/org/platformlambda/core/models/AsyncInbox.java on lines 117..127

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 94.

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

    private boolean createTopicOrQueue(boolean isTopic, String topicOrQueue, int partitions) throws IOException {
        ConnectorConfig.validateTopicName(topicOrQueue);
        try {
            EventEnvelope init = PostOffice.getInstance().request(cloudManager, 20000,
                    new Kv(TYPE, CREATE), new Kv(isTopic? TOPIC : QUEUE, topicOrQueue), new Kv(PARTITIONS, partitions));
connectors/adapters/activemq/activemq-connector/src/main/java/org/platformlambda/activemq/services/PubSubManager.java on lines 114..127

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 94.

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

    private boolean createTopicOrQueue(boolean isTopic, String topicOrQueue, int partitions) throws IOException {
        ConnectorConfig.validateTopicName(topicOrQueue);
        try {
            EventEnvelope init = PostOffice.getInstance().request(cloudManager, 20000,
                    new Kv(TYPE, CREATE), new Kv(isTopic? TOPIC : QUEUE, topicOrQueue), new Kv(PARTITIONS, partitions));
connectors/adapters/tibco/tibco-connector/src/main/java/org/platformlambda/tibco/services/PubSubManager.java on lines 115..128

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 94.

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

    public void addOption(String element) {
        int colon = element.indexOf(':');
        String key = element.substring(0, colon).trim().toLowerCase();
        String value = element.substring(colon+1).trim();
        if (key.equals(ACCESS_CONTROL_ORIGIN) && origin != null) {
system/platform-core/src/main/java/org/platformlambda/automation/models/CorsInfo.java on lines 52..61

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 92.

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

    private void notifyLifeCycleSubscribers(Kv...parameters) {
        if (!lifeCycleSubscribers.isEmpty()) {
            for (String subscriber: lifeCycleSubscribers.keySet()) {
                try {
                    EventEnvelope event = new EventEnvelope().setTo(subscriber);
connectors/core/cloud-connector/src/main/java/org/platformlambda/cloud/services/ServiceRegistry.java on lines 462..476

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 92.

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

    public void addHeader(String element) {
        int colon = element.indexOf(':');
        String key = element.substring(0, colon).trim().toLowerCase();
        String value = element.substring(colon+1).trim();
        if (key.equals(ACCESS_CONTROL_ORIGIN) && origin != null) {
system/platform-core/src/main/java/org/platformlambda/automation/models/CorsInfo.java on lines 41..50

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 92.

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

    private void notifyPmSubscribers(Kv...parameters) {
        if (!pmSubscribers.isEmpty()) {
            for (String subscriber: pmSubscribers.keySet()) {
                try {
                    EventEnvelope event = new EventEnvelope().setTo(subscriber);
connectors/core/cloud-connector/src/main/java/org/platformlambda/cloud/services/ServiceRegistry.java on lines 446..460

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 92.

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 handleEvent has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public void handleEvent(AssignedRoute route, String requestId, int status, String error) {
        AsyncContextHolder holder = contexts.get(requestId);
        if (holder != null) {
            HttpServerRequest request = holder.request;
            SimpleHttpUtility httpUtil = SimpleHttpUtility.getInstance();

    Method incoming has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public void incoming(EventEnvelope message) throws IOException {
            PostOffice po = PostOffice.getInstance();
            Map<String, String> control = message.getHeaders();
            if (message.getTo() != null) {
                String to = message.getTo();

      Method publish has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @Override
          public void publish(String topic, int partition, Map<String, String> headers, Object body) throws IOException {
              ConnectorConfig.validateTopicName(topic);
              Utility util = Utility.getInstance();
              Map<String, String> eventHeaders = headers == null? new HashMap<>() : headers;

        Method safeXmlKey has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private String safeXmlKey(String str) {
                boolean valid = true;
                for (int i=0; i < str.length(); i++) {
                    char c = str.charAt(i);
                    if (c >= '0' && c <= '9') continue;

          Method sendAppInfo has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private void sendAppInfo(long n, boolean alive) {
                  if (monitor != null) {
                      try {
                          Utility util = Utility.getInstance();
                          Platform platform = Platform.getInstance();

            Method run has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    @Override
                    public void run() {
                        long t1 = 0;
                        long t2 = System.currentTimeMillis();
                        while (normal) {

              Method loadRouteSubstitution has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  @SuppressWarnings("unchecked")
                  private void loadRouteSubstitution() {
                      AppConfigReader config = AppConfigReader.getInstance();
                      String location = config.getProperty(ROUTE_SUBSTITUTION_FILE);
                      if (location != null) {

                Method run has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        @Override
                        public void run() {
                            final AppConfigReader config = AppConfigReader.getInstance();
                            final Utility util = Utility.getInstance();
                            final long timeout = util.str2long(config.getProperty("websocket.idle.timeout", "60"));

                  Method deleteTopic has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private void deleteTopic(String topic) {
                          if (topicSubstitution) {
                              if (preAllocatedTopics.get(topic) == null) {
                                  throw new IllegalArgumentException("Missing topic substitution for "+topic);
                              }

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

                        @Override
                        public boolean createTopic(String topic, int partitions) throws IOException {
                            ConnectorConfig.validateTopicName(topic);
                            try {
                                EventEnvelope init = PostOffice.getInstance().request(cloudManager, 20000,
                    connectors/adapters/kafka/kafka-connector/src/main/java/org/platformlambda/kafka/services/PubSubManager.java on lines 152..166

                    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 87.

                    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

                        @Override
                        public boolean createTopic(String topic, int partitions) throws IOException {
                            ConnectorConfig.validateTopicName(topic);
                            try {
                                EventEnvelope init = PostOffice.getInstance().request(cloudManager, 20000,
                    connectors/adapters/hazelcast/hazelcast-connector/src/main/java/org/platformlambda/hazelcast/services/PubSubManager.java on lines 93..107

                    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 87.

                    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 str2localtime has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public LocalDateTime str2localtime(String str, boolean throwException) {
                            if (str == null) {
                                if (throwException) {
                                    throw new IllegalArgumentException("time string cannot be null");
                                } else {
                      Severity
                      Category
                      Status
                      Source
                      Language