silentbalanceyh/vertx-zero

View on GitHub
vertx-pin/zero-is/src/main/modulat/io/vertx/mod/is/refine/IsDir.java

Summary

Maintainability
C
1 day
Test Coverage

File IsDir.java has 265 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package io.vertx.mod.is.refine;

import cn.vertxup.integration.domain.tables.daos.IDirectoryDao;
import cn.vertxup.integration.domain.tables.pojos.IDirectory;
import io.horizon.atom.common.Kv;
Severity: Minor
Found in vertx-pin/zero-is/src/main/modulat/io/vertx/mod/is/refine/IsDir.java - About 2 hrs to fix

    Method createChild has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private static Future<IDirectory> createChild(final Future<IDirectory> futureParent,
                                                      final IDirectory child,
                                                      final JsonObject params) {
            final UxJooq jq = Ux.Jooq.on(IDirectoryDao.class);
            final String updatedBy = params.getString(KName.UPDATED_BY);

      Method updateLeaf has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @SuppressWarnings("all")
          static Future<IDirectory> updateLeaf(final JsonArray directoryA, final JsonObject params) {
              // Query all directory here;
              final List<IDirectory> directories = Ux.fromJson(directoryA, IDirectory.class);
              final List<String> storePath = Ut.toList(params.getJsonArray(KName.STORE_PATH));

        Method diff has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            static ConcurrentMap<ChangeFlag, JsonArray> diff(final JsonArray input, final List<IDirectory> directories) {
                /*
                 *  IDirectory
                 */
                final ConcurrentMap<String, IDirectory> directoryMap = Ut.elementMap(directories, IDirectory::getStorePath);

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

              @SuppressWarnings("all")
              static Future<IDirectory> updateLeaf(final JsonArray directoryA, final JsonObject params) {
                  // Query all directory here;
                  final List<IDirectory> directories = Ux.fromJson(directoryA, IDirectory.class);
                  final List<String> storePath = Ut.toList(params.getJsonArray(KName.STORE_PATH));
          Severity: Minor
          Found in vertx-pin/zero-is/src/main/modulat/io/vertx/mod/is/refine/IsDir.java - About 45 mins to fix

          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

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

              static ConcurrentMap<String, String> rollback(final Set<String> pathSet) {
                  final ConcurrentMap<String, String> trashMap = new ConcurrentHashMap<>();
                  pathSet.forEach(path -> {
                      final String trashFrom = Ut.ioPath(IsFolder.TRASH_FOLDER, path);
                      trashMap.put(trashFrom, path);
          vertx-pin/zero-is/src/main/modulat/io/vertx/mod/is/refine/IsDir.java on lines 39..46

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

          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

              static ConcurrentMap<String, String> trash(final Set<String> pathSet) {
                  final ConcurrentMap<String, String> trashMap = new ConcurrentHashMap<>();
                  pathSet.forEach(path -> {
                      final String trashTo = Ut.ioPath(IsFolder.TRASH_FOLDER, path);
                      trashMap.put(path, trashTo);
          vertx-pin/zero-is/src/main/modulat/io/vertx/mod/is/refine/IsDir.java on lines 54..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 52.

          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 3 locations. Consider refactoring.
          Open

                  return new ConcurrentHashMap<>() {
                      {
                          this.put(ChangeFlag.ADD, queueAD);
                          this.put(ChangeFlag.UPDATE, queueUP);
                          this.put(ChangeFlag.NONE, queueDft);
          vertx-pin/zero-atom/src/main/modulat/io/vertx/mod/atom/refine/AoCompare.java on lines 90..96
          vertx-pin/zero-atom/src/main/modulat/io/vertx/mod/atom/refine/AoCompare.java on lines 415..421

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

          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

              static JsonArray input(JsonArray directoryJ) {
                  directoryJ = directoryJ.copy();
                  Ut.valueToString(directoryJ,
                      KName.METADATA,
                      KName.VISIT_GROUP,
          vertx-pin/zero-is/src/main/modulat/io/vertx/mod/is/refine/IsDir.java on lines 63..73

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

          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

              static JsonObject input(JsonObject directoryJ) {
                  // Cannot deserialize value of type `java.lang.String` from Array value (token `JsonToken.START_ARRAY`)
                  directoryJ = directoryJ.copy();
                  Ut.valueToString(directoryJ,
                      KName.METADATA,
          vertx-pin/zero-is/src/main/modulat/io/vertx/mod/is/refine/IsDir.java on lines 75..84

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

          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

          There are no issues that match your filters.

          Category
          Status