silentbalanceyh/vertx-zero

View on GitHub

Showing 9,050 of 9,050 total issues

Method authorize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public Future<JsonObject> authorize(final WRecord record, final String userId) {
        if (Objects.isNull(userId)) {
            /*
             * `userId` is null, it means that the user haven't logged into

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

    @Override
    public boolean match(final AuthorizationContext context) {
        Objects.requireNonNull(context);
        final User user = context.user();
        if (user != 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 ok has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public Future<JsonArray> ok(final JsonArray columns, final Object linkedObj) {
        /*
         * Fix Bug:
         * java.lang.ClassCastException: io.vertx.core.json.JsonObject cannot be cast to io.vertx.core.json.JsonArray

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

    @java.lang.Override
    public boolean equals(final java.lang.Object obj) {
        if (obj == this) {
            return true;
        }

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

    @Override
    public String toString() {
        return "Epsilon{" +
            "name='" + this.name + '\'' +
            ", mime=" + this.mime +
vertx-pin/zero-ui/src/main/modulat/io/vertx/mod/ui/atom/UiConfig.java on lines 105..115

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

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

    @Override
    public String toString() {
        return "UiConfig{" +
            "definition='" + this.definition + '\'' +
            ", mapping=" + this.mapping +
vertx-gaia/vertx-up/src/main/java/io/vertx/up/atom/Epsilon.java on lines 87..97

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

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

    private Resolver<T> getResolver(final RoutingContext context,
                                    final Epsilon<T> income) {
        /* 1.Read the resolver first **/
        final Annotation annotation = income.getAnnotation();
        final Class<?> resolverCls = Ut.invoke(annotation, YmlCore.resolver.__KEY);

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

        static <T, R> Future<R> complex(final Pagination first,
                                        final Function<T, Future<Integer>> totalConsumer,
                                        final Function<Pagination, Future<T>> pageConsumer,
                                        final Function<T, Future<R>> responseBuilder,
                                        final BinaryOperator<R> fnReduce) {
    Severity: Minor
    Found in vertx-gaia/vertx-up/src/main/java/io/vertx/up/unity/Complex.java - About 1 hr to fix

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

          private static Set<Method> nativeBridgeMethod(final Class<?> clazz) {
              final Method[] methods = clazz.getDeclaredMethods();
              final Set<Method> methodSet = new HashSet<>();
              for (final Method method : methods) {
                  /*
      Severity: Minor
      Found in vertx-gaia/vertx-up/src/main/java/io/vertx/up/unity/Atomic.java - About 1 hr to fix

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

            public static HEnergy of(final JsonObject config) {
                final KEnergy energy = new KEnergy();
                final JsonObject component = HUt.valueJObject(config, VSpec.Boot.COMPONENT);
                final JsonObject configJ = HUt.valueJObject(config, VSpec.Boot.CONFIG);
                /*

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

              @Override
              public boolean cp(final String nameFrom, final String nameTo) {
                  final File fileSrc = new File(nameFrom);
                  final File fileDst = new File(nameTo);
                  if (fileSrc.exists() && fileDst.exists()) {
          Severity: Minor
          Found in vertx-gaia/vertx-ams/src/main/jib/io/horizon/uca/fs/LocalFs.java - About 1 hr to fix

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

                @SuppressWarnings("unchecked")
                static <T> Constructor<T> constructor(final Class<?> clazz, final Object... params) {
                    final int length = params.length;
                    // Fix:Cannot invoke "java.util.concurrent.ConcurrentMap.getOrDefault(Object, Object)" because "map" is null
                    final ConcurrentMap<Integer, Integer> map = BUILD_IN.getOrDefault(clazz, new ConcurrentHashMap<>());
            Severity: Minor
            Found in vertx-gaia/vertx-ams/src/main/java/io/horizon/util/HInstance.java - About 1 hr to fix

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

                  void run(final Terminal terminal) {
                      final Consumer<Terminal> consumer = terminalRef -> {
                          /* Environment input again */
                          Sl.welcomeCommand(this.environment);
                          /* Continue here */

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

                    static boolean validate(final String[] args) {
                        final JsonObject input = Ut.valueJObject(SlConfig.validate().getJsonObject(YmlCore.shell.validate.INPUT));
                        /*
                         * 1. required arguments for complex shell building
                         */

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

                          @Override
                          public default IUiColumn fromJson(io.vertx.core.json.JsonObject json) {
                                  setOrThrow(this::setKey,json::getString,"KEY","java.lang.String");
                                  setOrThrow(this::setTitle,json::getString,"TITLE","java.lang.String");
                                  setOrThrow(this::setDataIndex,json::getString,"DATA_INDEX","java.lang.String");

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

                            @Override
                            public default IEEmployee fromJson(io.vertx.core.json.JsonObject json) {
                                    setOrThrow(this::setKey,json::getString,"KEY","java.lang.String");
                                    setOrThrow(this::setCompanyId,json::getString,"COMPANY_ID","java.lang.String");
                                    setOrThrow(this::setDeptId,json::getString,"DEPT_ID","java.lang.String");

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

                          void startWorkers(final Set<JtUri> uriSet) {
                              /*
                               * Non Js worker class here
                               */
                              {
                      Severity: Minor
                      Found in vertx-pin/zero-jet/src/main/modulat/io/vertx/mod/jet/JetCastor.java - About 1 hr to fix

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

                            static Envelop validateContained(final Class<?> clazz, final JsonObject data, final Set<String> paramContained) {
                                Envelop envelop = null;
                                if (null != paramContained && !paramContained.isEmpty()) {
                                    final JetThanatos verifier = JetThanatos.create(clazz);
                                    final Object value = data.getValue(KWeb.ARGS.PARAM_BODY);

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

                              @Override
                              public String toString() {
                                  StringBuilder sb = new StringBuilder("SPacket (");
                          
                                  sb.append(key);

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

                                @Override
                                public int hashCode() {
                                    final int prime = 31;
                                    int result = 1;
                                    result = prime * result + ((this.key == null) ? 0 : this.key.hashCode());
                              Severity
                              Category
                              Status
                              Source
                              Language