KnapsackPro/knapsack_pro-ruby

View on GitHub
lib/knapsack_pro/config/ci/base.rb

Summary

Maintainability
B
4 hrs
Test Coverage

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

        def ci_provider
          return 'AWS CodeBuild' if ENV.key?('CODEBUILD_BUILD_ARN')
          return 'Azure Pipelines' if ENV.key?('SYSTEM_TEAMFOUNDATIONCOLLECTIONURI')
          return 'Bamboo' if ENV.key?('bamboo_planKey')
          return 'Bitbucket Pipelines' if ENV.key?('BITBUCKET_COMMIT')
Severity: Minor
Found in lib/knapsack_pro/config/ci/base.rb - About 1 hr 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 too many return statements within this method.
Open

          return 'Drone.io' if ENV.key?('DRONE')
Severity: Major
Found in lib/knapsack_pro/config/ci/base.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

              return 'Other' if KnapsackPro::Config::Env.ci?
    Severity: Major
    Found in lib/knapsack_pro/config/ci/base.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                return 'Google Cloud Build' if ENV.key?('BUILDER_OUTPUT')
      Severity: Major
      Found in lib/knapsack_pro/config/ci/base.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                  return 'Buddy.works' if ENV.key?('BUDDY')
        Severity: Major
        Found in lib/knapsack_pro/config/ci/base.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                    return 'Jenkins' if ENV.key?('JENKINS_URL')
          Severity: Major
          Found in lib/knapsack_pro/config/ci/base.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                      return 'TeamCity' if ENV.key?('TEAMCITY_VERSION')
            Severity: Major
            Found in lib/knapsack_pro/config/ci/base.rb - About 30 mins to fix

              There are no issues that match your filters.

              Category
              Status