CloudSlang/cloud-slang

View on GitHub
cloudslang-content-verifier/src/main/java/io/cloudslang/lang/tools/build/SlangBuildMain.java

Summary

Maintainability
F
3 days
Test Coverage

File SlangBuildMain.java has 568 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*******************************************************************************
 * (c) Copyright 2016 Hewlett-Packard Development Company, L.P.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Apache License v2.0 which accompany this distribution.
 *

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

        public static void main(String[] args) {
            loadUserProperties();
            configureLog4j();
    
            ApplicationArgs appArgs = new ApplicationArgs();

      SlangBuildMain has 35 methods (exceeds 20 allowed). Consider refactoring.
      Open

      public class SlangBuildMain {
          public static final String DEFAULT_TESTS = "default";
      
          private static final String TEST_CASE_REPORT_LOCATION = "cloudslang.test.case.report.location";
          private static final String CONTENT_DIR = File.separator + "content";

        Method main has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            public static void main(String[] args) {
                loadUserProperties();
                configureLog4j();
        
                ApplicationArgs appArgs = new ApplicationArgs();

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

            private static void configureLog4j() {
                String configFilename = System.getProperty(LOG4J_CONFIGURATION_KEY);
                String errorMessage = null;
        
                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

        Method parseThreadCountArg has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            private static int parseThreadCountArg(ApplicationArgs appArgs, boolean isParallel) {
                if (!isParallel) {
                    return 1;
                } else {
                    int defaultThreadCount = Runtime.getRuntime().availableProcessors();

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

            private static void configureLog4j() {
                String configFilename = System.getProperty(LOG4J_CONFIGURATION_KEY);
                String errorMessage = null;
        
                try {

          Method updateTestSuiteMappings has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              private static void updateTestSuiteMappings(final TestRunInfoService testRunInfoService,
                                                          final List<String> parallelSuites,
                                                          final List<String> sequentialSuites, final List<String> activeSuites,
                                                          final TestCaseRunMode unspecifiedTestSuiteRunMode) {

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

                private static void printCoveredExecutables(Set<String> coveredExecutables, final LoggingService loggingService) {
                    loggingService.logEvent(INFO, "");
                    loggingService.logEvent(INFO, "------------------------------------------------------------");
                    loggingService.logEvent(INFO, "Following " + coveredExecutables.size() + " executables have tests:");
                    for (String executable : coveredExecutables) {
            cloudslang-content-verifier/src/main/java/io/cloudslang/lang/tools/build/SlangBuildMain.java on lines 662..671

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

            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

                private static void printUncoveredExecutables(Set<String> uncoveredExecutables,
                                                              final LoggingService loggingService) {
                    loggingService.logEvent(INFO, "");
                    loggingService.logEvent(INFO, "------------------------------------------------------------");
                    loggingService.logEvent(INFO, "Following " + uncoveredExecutables.size() +
            cloudslang-content-verifier/src/main/java/io/cloudslang/lang/tools/build/SlangBuildMain.java on lines 653..660

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

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

                @SuppressWarnings("Duplicates")
                private static void loadUserProperties() {
                    try {
                        UserConfigurationService userConfigurationService = new UserConfigurationServiceImpl();
                        userConfigurationService.loadUserProperties();
            cloudslang-cli/src/main/java/io/cloudslang/lang/cli/SlangBootstrap.java on lines 29..38

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

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

                    for (Map.Entry<String, TestRun> skippedTest : skippedTests.entrySet()) {
                        String message = skippedTest.getValue().getMessage();
                        loggingService.logEvent(INFO, "- " + message.replaceAll("\n", "\n\t"));
                    }
            cloudslang-content-verifier/src/main/java/io/cloudslang/lang/tools/build/SlangBuildMain.java on lines 621..624

            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

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

                    for (Map.Entry<String, TestRun> failedTest : failedTests.entrySet()) {
                        String failureMessage = failedTest.getValue().getMessage();
                        loggingService.logEvent(ERROR, "- " + failureMessage.replaceAll("\n", "\n\t"));
                    }
            cloudslang-content-verifier/src/main/java/io/cloudslang/lang/tools/build/SlangBuildMain.java on lines 633..636

            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

            There are no issues that match your filters.

            Category
            Status