lethalpaga/cfncli

View on GitHub
lib/cfncli/cli.rb

Summary

Maintainability
C
1 day
Test Coverage

File cli.rb has 299 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'thor'
require 'aws-sdk-cloudformation'

require 'cfncli/cloudformation'
require 'cfncli/config'
Severity: Minor
Found in lib/cfncli/cli.rb - About 3 hrs to fix

    Method parse_cli_params has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

          def parse_cli_params(params)
            validation_failures = []
            parsed_params = params.map.with_index do |param, i|
              key, value = param.split(',', 2)
              if key.to_s.empty? || value.to_s.empty?
    Severity: Minor
    Found in lib/cfncli/cli.rb - About 3 hrs 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 apply has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def apply
          opts = process_params(options)
    
          stack_name = opts['stack_name']
          fail ArgumentError, 'stack_name is required' unless stack_name
    Severity: Minor
    Found in lib/cfncli/cli.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

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

          def process_params(opts)
            opts = opts.dup
            check_exclusivity(opts.keys, ['template_body', 'template_url'])
            check_exclusivity(opts.keys, ['disable_rollback', 'on_failure'])
            check_exclusivity(opts.keys, ['stack_policy_body', 'stack_policy_url'])
    Severity: Minor
    Found in lib/cfncli/cli.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

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

        def delete
          opts = options.dup
          stack_name = opts['stack_name']
    
          fail ArgumentError, 'stack_name is required' unless stack_name
    Severity: Minor
    Found in lib/cfncli/cli.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

    There are no issues that match your filters.

    Category
    Status