aws/aws-codedeploy-agent

View on GitHub
lib/aws/codedeploy/local/deployer.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Method build_spec has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def build_spec(location, bundle_type, deployment_group_id, file_exists_behavior, all_possible_lifecycle_events, deployment_group_name, application_name, appspec_filename)
Severity: Major
Found in lib/aws/codedeploy/local/deployer.rb - About 1 hr to fix

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

            def s3_revision(location, uri, bundle_type)
              bucket = uri.host
              if (uri.path[0] != '/')
                raise AWS::CodeDeploy::Local::CLIValidator::ValidationError.new("s3 location #{location} not in the expected format of 's3://bucket/key'")
              end
    Severity: Minor
    Found in lib/aws/codedeploy/local/deployer.rb - About 45 mins 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

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

            def initialize(configuration_file_location = CONF_DEFAULT_LOCATION)
              configuration_file_location ||= CONF_DEFAULT_LOCATION # Default gets set this way even if the input is nil
              if IS_WINDOWS then self.class.configure_windows_certificate end
    
              if File.file?(configuration_file_location) && File.readable?(configuration_file_location)
    Severity: Minor
    Found in lib/aws/codedeploy/local/deployer.rb - About 45 mins 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

    Method github_revision has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

            def github_revision(location, uri, bundle_type)
              if uri.host == 'github.com' && match = uri.path.match(/\/([^\/]*)\/(.*)$/i)
                owner, repository_name = match.captures
                commit = 'HEAD'
              elsif match = uri.path.match(/\/repos\/([^\/]*)\/([^\/]*)\/.*\/(.*)$/i)
    Severity: Minor
    Found in lib/aws/codedeploy/local/deployer.rb - About 35 mins 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

    Method revision has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

            def revision(location, bundle_type)
              uri = URI.parse(location)
              if (uri.scheme == 's3')
                s3_revision(location, uri, bundle_type)
              elsif (uri.scheme == 'https' && uri.host.end_with?('github.com'))
    Severity: Minor
    Found in lib/aws/codedeploy/local/deployer.rb - About 25 mins 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

    There are no issues that match your filters.

    Category
    Status