seanedwards/cfer

View on GitHub
lib/cfer.rb

Summary

Maintainability
D
1 day
Test Coverage

Method converge! has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    def converge!(stack_name, options = {})
      config(options)
      options[:on_failure].upcase! if options[:on_failure]
      tmpl = options[:template] || "#{stack_name}.rb"
      cfn = options[:aws_options] || {}
Severity: Minor
Found in lib/cfer.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

File cfer.rb has 289 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'active_support/all'
require 'aws-sdk-cloudformation'
require 'aws-sdk-s3'
require 'logger'
require 'json'
Severity: Minor
Found in lib/cfer.rb - About 2 hrs to fix

Method describe! has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def describe!(stack_name, options = {})
      config(options)
      cfn = options[:aws_options] || {}
      cfn_stack = options[:cfer_client] || Cfer::Cfn::Client.new(cfn.merge(stack_name: stack_name))
      cfn_metadata = cfn_stack.fetch_metadata
Severity: Minor
Found in lib/cfer.rb - About 2 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 converge! has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def converge!(stack_name, options = {})
      config(options)
      options[:on_failure].upcase! if options[:on_failure]
      tmpl = options[:template] || "#{stack_name}.rb"
      cfn = options[:aws_options] || {}
Severity: Minor
Found in lib/cfer.rb - About 1 hr to fix

Method describe! has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def describe!(stack_name, options = {})
      config(options)
      cfn = options[:aws_options] || {}
      cfn_stack = options[:cfer_client] || Cfer::Cfn::Client.new(cfn.merge(stack_name: stack_name))
      cfn_metadata = cfn_stack.fetch_metadata
Severity: Minor
Found in lib/cfer.rb - About 1 hr to fix

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

    def delete!(stack_name, options = {})
      config(options)
      cfn = options[:aws_options] || {}
      cfn_stack = options[:cfer_client] || cfn_stack = Cfer::Cfn::Client.new(cfn.merge(stack_name: stack_name))

Severity: Minor
Found in lib/cfer.rb - About 55 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

Avoid deeply nested control flow statements.
Open

                rollback_opts[:role_arn] = options[:role_arn] if options[:role_arn]
Severity: Major
Found in lib/cfer.rb - About 45 mins to fix

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

    def generate_final_parameters(options)
      raise Cfer::Util::CferError, "parameter-environment set but parameter_file not set" \
        if options[:parameter_environment] && options[:parameter_file].nil?

      final_params = HashWithIndifferentAccess.new
Severity: Minor
Found in lib/cfer.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

There are no issues that match your filters.

Category
Status