CloudSlang/cs-actions

View on GitHub

Showing 3,994 of 4,023 total issues

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

    private ManagedObjectReference getDataCenterMor(String dataCenterName, ManagedObjectReference mor, MoRefHandler moRefHandler)
            throws InvalidPropertyFaultMsg, RuntimeFaultFaultMsg {

        ManagedObjectReference dataCenterMor = moRefHandler.inContainerByType(mor, ManagedObjectType.DATA_CENTER.getValue())
                .get(dataCenterName);
cs-vmware/src/main/java/io/cloudslang/content/vmware/connection/ConnectionResources.java on lines 192..202

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

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

            if (isNotEmpty(ipVersion)) {
                if (ipVersion.equals(IP_VERSION_6)) {
                    command.append("-A inet6 ");
                } else if (ipVersion.equals(IP_VERSION_4)) {
                    command.append("-A inet ");
cs-utilities/src/main/java/io/cloudslang/content/utilities/services/localping/WindowsPingCommand.java on lines 57..65

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

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

        if (isNotEmpty(ipVersion)) {
            if (ipVersion.equals(IP_VERSION_6)) {
                command.append("-6 ");
            } else if (ipVersion.equals(IP_VERSION_4)) {
                command.append("-4 ");
cs-utilities/src/main/java/io/cloudslang/content/utilities/services/localping/SunOsPingCommand.java on lines 75..83

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

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 static String restartInstance(final String proxyHost,
                                         final String proxyPort,
                                         final String proxyUsername,
                                         final String proxyPassword,
                                         final String instanceId,
cs-alibaba/src/main/java/io/cloudslang/content/alibaba/services/InstanceService.java on lines 171..186

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

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

            if (start + index <= end) {
                ret = "" + (index + start);
                index += increment;
                session.setValue(index);
            } else
cs-utilities/src/main/java/io/cloudslang/content/utilities/entities/CounterImpl.java on lines 65..70

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

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 static String startInstance(final String proxyHost,
                                       final String proxyPort,
                                       final String proxyUsername,
                                       final String proxyPassword,
                                       final String instanceId,
cs-alibaba/src/main/java/io/cloudslang/content/alibaba/services/InstanceService.java on lines 210..225

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

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

            if (!StringUtils.isEmpty(defaultMaxPerRoute)) {
                try {
                    connManager.setDefaultMaxPerRoute(Integer.parseInt(defaultMaxPerRoute));
                } catch (NumberFormatException e) {
                    throw new IllegalArgumentException("the '" + HttpClientInputs.CONNECTIONS_MAX_PER_ROUTE
cs-http-client/src/main/java/io/cloudslang/content/httpclient/build/conn/ConnectionManagerBuilder.java on lines 122..129

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

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

    public Map<String, String> execute(SSHShellInputs sshShellInputs) {
        Map<String, String> returnResult = new HashMap<>();
        SSHService service = null;
        boolean providerAdded = addSecurityProvider();
        String sessionId = "";

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

    public Map<String, String> execute(ResetUserPasswordInput input) {

        Map<String, String> results = ResultUtils.createNewResultsEmptyMap();
        try {
            LDAPQuery ldap = new LDAPQuery();

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 runShellCommand has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

            String command,
            String characterSet,
            boolean usePseudoTerminal,
            int connectTimeout,
            int commandTimeout,

    Method runShell has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

                final String command,
                final String characterSet,
                boolean usePseudoTerminal,
                int connectTimeout,
                int commandTimeout,

      Method runShell has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          CommandResult runShell(String command, String characterSet, boolean usePseudoTerminal, int connectTimeout, int commandTimeout, boolean agentForwarding);
      Severity: Minor
      Found in cs-ssh/src/main/java/io/cloudslang/content/ssh/services/SSHService.java - About 45 mins to fix

        Method runShellCommand has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            CommandResult runShellCommand(String command, String characterSet, boolean usePseudoTerminal, int connectTimeout, int commandTimeout, boolean agentForwarding);
        Severity: Minor
        Found in cs-ssh/src/main/java/io/cloudslang/content/ssh/services/SSHService.java - About 45 mins to fix

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

              public Map<String, String> execute(MoveComputerAccountToOUInput input) {
          
                  Map<String, String> results = ResultUtils.createNewResultsEmptyMap();
          
                  try {

          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 (codepoint > 127) {
                                          buf.append("&#x");
                                          buf.append(Integer.toHexString(codepoint).toUpperCase());
                                          buf.append(";");
                                          if (Character.isSupplementaryCodePoint(codepoint)) {

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

                private static Date parseDate(String toParse, int style, Locale locale) throws ParseException {
                    Date d;
                    try {
                        DateFormat f = DateFormat.getDateTimeInstance(style, DateFormat.MEDIUM, locale);
                        d = f.parse(toParse);

            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 convertPdfToImage has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                private static List<File> convertPdfToImage(File file, String destination, String dpi, String fromPage,
                                                            String toPage, String pageIndex) throws Exception {

              Method fileCreation has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  private static void fileCreation(String destination, Integer dpi, PDFRenderer renderer, List<File> fileList,
                                                   String fileName, Integer i) throws IOException {

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

                    @Action(name = ADD_ACCOUNT,
                            description = ADD_ACCOUNT_DESCRIPTION,
                            outputs = {
                                    @Output(RETURN_RESULT),
                                    @Output(STATUS_CODE),

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

                    public static <T extends Enum<T>> String getEnumValidValuesString(Class<T> inputEnum) {
                        StringBuilder sb = new StringBuilder();
                        for (T enumValue : inputEnum.getEnumConstants()) {
                            if (AuthType.class.getCanonicalName().equalsIgnoreCase(enumValue.getClass().getCanonicalName())) {
                                sb.append(((AuthType) enumValue).getValue()).append(COMMA).append(BLANK_SPACE);

                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

                Severity
                Category
                Status
                Source
                Language