ZestFinance/knife-instance

View on GitHub

Showing 5 of 5 total issues

Class ZestKnife has 31 methods (exceeds 20 allowed). Consider refactoring.
Open

class ZestKnife < Chef::Knife
  attr_accessor :base_domain
  attr_accessor :internal_domain

  def msg_pair(label, value, color=:cyan)
Severity: Minor
Found in lib/knife-instance/zestknife.rb - About 3 hrs to fix

    Method run has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def run
            $stdout.sync = true
            setup_config
    
            @environment = config[:environment]
    Severity: Minor
    Found in lib/chef/knife/instance_create.rb - About 1 hr to fix

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

            def self.new_with_defaults environment, region, color, base_domain, opts
      Severity: Minor
      Found in lib/chef/knife/instance_create.rb - About 35 mins to fix

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

            def initialize(validation_key_file, validation_client_name, chef_server_url, encrypted_databag_secret_file, attr = {})
        Severity: Minor
        Found in lib/knife-instance/bootstrap_generator.rb - About 35 mins to fix

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

            def zone
              unless @zone
                self.class.in_all_aws_regions do |zest_aws|
                  @zone ||= zest_aws.dns.zones.detect { |z| z.domain.downcase == domain }
                end
          Severity: Minor
          Found in lib/knife-instance/zestknife.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

          Severity
          Category
          Status
          Source
          Language