CloudSlang/cs-actions

View on GitHub
cs-database/src/main/java/io/cloudslang/content/database/utils/SQLInputs.java

Summary

Maintainability
F
1 wk
Test Coverage

Method equals has a Cognitive Complexity of 110 (exceeds 5 allowed). Consider refactoring.
Open

    public boolean equals(Object o) {
        if (o == this) return true;
        if (!(o instanceof SQLInputs)) return false;
        final SQLInputs other = (SQLInputs) o;
        if (!other.canEqual((Object) this)) return false;

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

SQLInputs has 70 methods (exceeds 20 allowed). Consider refactoring.
Open

public class SQLInputs {
    private String sqlCommand;
    private String dbServer;
    private String dbName;
    private int dbPort;

    File SQLInputs.java has 597 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * Copyright 2019-2024 Open Text
     * This program and the accompanying materials
     * are made available under the terms of the Apache License v2.0 which accompany this distribution.
     *

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

          public boolean equals(Object o) {
              if (o == this) return true;
              if (!(o instanceof SQLInputs)) return false;
              final SQLInputs other = (SQLInputs) o;
              if (!other.canEqual((Object) this)) return false;

        SQLInputsBuilder has 29 methods (exceeds 20 allowed). Consider refactoring.
        Open

            public static class SQLInputsBuilder {
                private String sqlCommand;
                private String dbServer;
                private String dbName;
                private int dbPort;

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

              public int hashCode() {
                  final int PRIME = 59;
                  int result = 1;
                  final Object $sqlCommand = this.getSqlCommand();
                  result = result * PRIME + ($sqlCommand == null ? 43 : $sqlCommand.hashCode());

            Avoid too many return statements within this method.
            Open

                    if (this.isIgnoreCase() != other.isIgnoreCase()) return false;

              Avoid too many return statements within this method.
              Open

                      if (this$dbClass == null ? other$dbClass != null : !this$dbClass.equals(other$dbClass)) return false;

                Avoid too many return statements within this method.
                Open

                        if (this$dbType == null ? other$dbType != null : !this$dbType.equals(other$dbType)) return false;

                  Avoid too many return statements within this method.
                  Open

                          if (this.getTimeout() != other.getTimeout()) return false;

                    Avoid too many return statements within this method.
                    Open

                                return false;

                      Avoid too many return statements within this method.
                      Open

                              if (this.isTrustAllRoots() != other.isTrustAllRoots()) return false;

                        Avoid too many return statements within this method.
                        Open

                                if (this$key == null ? other$key != null : !this$key.equals(other$key)) return false;

                          Avoid too many return statements within this method.
                          Open

                                      return false;

                            Avoid too many return statements within this method.
                            Open

                                        return false;

                              Avoid too many return statements within this method.
                              Open

                                          return false;

                                Avoid too many return statements within this method.
                                Open

                                        if (this$dbServer == null ? other$dbServer != null : !this$dbServer.equals(other$dbServer)) return false;

                                  Avoid too many return statements within this method.
                                  Open

                                          if (this$dbName == null ? other$dbName != null : !this$dbName.equals(other$dbName)) return false;

                                    Avoid too many return statements within this method.
                                    Open

                                            if (this.getDbPort() != other.getDbPort()) return false;

                                      Avoid too many return statements within this method.
                                      Open

                                              if (this$lRows == null ? other$lRows != null : !this$lRows.equals(other$lRows)) return false;

                                        Avoid too many return statements within this method.
                                        Open

                                                    return false;

                                          Avoid too many return statements within this method.
                                          Open

                                                      return false;

                                            Avoid too many return statements within this method.
                                            Open

                                                    if (this$dbUrl == null ? other$dbUrl != null : !this$dbUrl.equals(other$dbUrl)) return false;

                                              Avoid too many return statements within this method.
                                              Open

                                                      if (this.getSkip() != other.getSkip()) return false;

                                                Avoid too many return statements within this method.
                                                Open

                                                            return false;

                                                  Avoid too many return statements within this method.
                                                  Open

                                                          if (this.isNetcool() != other.isNetcool()) return false;

                                                    Avoid too many return statements within this method.
                                                    Open

                                                                return false;

                                                      Avoid too many return statements within this method.
                                                      Open

                                                                  return false;

                                                        Avoid too many return statements within this method.
                                                        Open

                                                                    return false;

                                                          Avoid too many return statements within this method.
                                                          Open

                                                                      return false;

                                                            Avoid too many return statements within this method.
                                                            Open

                                                                        return false;

                                                              Avoid too many return statements within this method.
                                                              Open

                                                                      if (this$strDelim == null ? other$strDelim != null : !this$strDelim.equals(other$strDelim)) return false;

                                                                Avoid too many return statements within this method.
                                                                Open

                                                                        if (this.getIUpdateCount() != other.getIUpdateCount()) return false;

                                                                  Avoid too many return statements within this method.
                                                                  Open

                                                                          if (this$username == null ? other$username != null : !this$username.equals(other$username)) return false;

                                                                    Avoid too many return statements within this method.
                                                                    Open

                                                                            if (this$password == null ? other$password != null : !this$password.equals(other$password)) return false;

                                                                      Avoid too many return statements within this method.
                                                                      Open

                                                                                  return false;

                                                                        Avoid too many return statements within this method.
                                                                        Open

                                                                                if (this$instance == null ? other$instance != null : !this$instance.equals(other$instance)) return false;

                                                                          Avoid too many return statements within this method.
                                                                          Open

                                                                                  return true;

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

                                                                                        return "io.cloudslang.content.database.utils.SQLInputs.SQLInputsBuilder(sqlCommand=" + this.sqlCommand + ", dbServer=" + this.dbServer + ", dbName=" + this.dbName + ", dbPort=" + this.dbPort + ", dbType=" + this.dbType + ", key=" + this.key + ", username=" + this.username + ", password=" + this.password + ", authenticationType=" + this.authenticationType + ", instance=" + this.instance + ", ignoreCase=" + this.ignoreCase + ", timeout=" + this.timeout + ", dbUrl=" + this.dbUrl + ", dbClass=" + this.dbClass + ", isNetcool=" + this.isNetcool + ", lRowsFiles=" + this.lRowsFiles + ", lRowsNames=" + this.lRowsNames + ", skip=" + this.skip + ", strDelim=" + this.strDelim + ", strColumns=" + this.strColumns + ", lRows=" + this.lRows + ", iUpdateCount=" + this.iUpdateCount + ", databasePoolingProperties=" + this.databasePoolingProperties + ", trustStore=" + this.trustStore + ", trustStorePassword=" + this.trustStorePassword + ", trustAllRoots=" + this.trustAllRoots + ", authLibraryPath=" + this.authLibraryPath + ", colDelimiter=" + this.colDelimiter + ", rowDelimiter=" + this.rowDelimiter + ", resultSetType=" + this.resultSetType + ", resultSetConcurrency=" + this.resultSetConcurrency + ", sqlCommands=" + this.sqlCommands + ")";
                                                                            cs-azure/src/main/java/io/cloudslang/content/azure/entities/StorageInputs.java on lines 153..153

                                                                            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

                                                                            There are no issues that match your filters.

                                                                            Category
                                                                            Status