silentbalanceyh/vertx-zero

View on GitHub
vertx-gaia/vertx-ams/src/main/java/io/horizon/util/CGroup.java

Summary

Maintainability
B
6 hrs
Test Coverage

Method group has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    static <K, V, E> ConcurrentMap<K, List<V>> group(final Collection<E> object, final Function<E, K> keyFn, final Function<E, V> valueFn) {
        final ConcurrentMap<K, List<V>> ret = new ConcurrentHashMap<>();
        if (Objects.nonNull(object) && !object.isEmpty()) {
            for (final E item : object) {
                if (null != item) {
Severity: Minor
Found in vertx-gaia/vertx-ams/src/main/java/io/horizon/util/CGroup.java - About 3 hrs 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

Avoid deeply nested control flow statements.
Open

                        if (null == reference) {
                            reference = new ArrayList<>();
                        }
Severity: Major
Found in vertx-gaia/vertx-ams/src/main/java/io/horizon/util/CGroup.java - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if (null != value) {
                                reference.add(value);
                            }
    Severity: Major
    Found in vertx-gaia/vertx-ams/src/main/java/io/horizon/util/CGroup.java - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if (ret.containsKey(key)) {
                                  reference = ret.get(key);
                              }
      Severity: Major
      Found in vertx-gaia/vertx-ams/src/main/java/io/horizon/util/CGroup.java - About 45 mins to fix

        There are no issues that match your filters.

        Category
        Status