matschaffer/knife-solo

View on GitHub

Showing 15 of 15 total issues

Class SoloCook has 38 methods (exceeds 20 allowed). Consider refactoring.
Open

    class SoloCook < Knife

      include KnifeSolo::SshCommand
      include KnifeSolo::NodeConfigCommand
      include KnifeSolo::Tools
Severity: Minor
Found in lib/chef/knife/solo_cook.rb - About 5 hrs to fix

    Method run_command has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

        def run_command(command, output = nil)
          result = ExecResult.new
    
          session.open_channel do |channel|
            channel.request_pty
    Severity: Minor
    Found in lib/knife-solo/ssh_connection.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 solo_cook.rb has 281 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'chef/knife'
    
    require 'knife-solo/ssh_command'
    require 'knife-solo/node_config_command'
    require 'knife-solo/tools'
    Severity: Minor
    Found in lib/chef/knife/solo_cook.rb - About 2 hrs to fix

      Method included has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def self.included(other)
            other.class_eval do
              # Lazy load our dependencies if the including class did not call
              # Knife#deps yet. Later calls to #deps override previous ones, so if
              # the outer class calls it, it should also call our #load_deps, i.e:
      Severity: Major
      Found in lib/knife-solo/ssh_command.rb - About 2 hrs to fix

        Method run has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

              def run
                time('Run') do
        
                  if config[:skip_chef_check]
                    ui.warn '`--skip-chef-check` is deprecated, please use `--no-chef-check`.'
        Severity: Minor
        Found in lib/chef/knife/solo_cook.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

        File ssh_command.rb has 253 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module KnifeSolo
          module SshCommand
        
            def self.load_deps
              require 'knife-solo/ssh_connection'
        Severity: Minor
        Found in lib/knife-solo/ssh_command.rb - About 2 hrs to fix

          Method distro has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def distro
                return @distro if @distro
                @distro = case issue
                when %r{Debian GNU/Linux [6789]}
                  {:type => (x86? ? "debianoid_omnibus" : "debianoid_gem")}
          Severity: Minor
          Found in lib/knife-solo/bootstraps/linux.rb - About 1 hr to fix

            Method generate_node_config has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def generate_node_config
                  if node_config.exist?
                    Chef::Log.debug "Node config '#{node_config}' already exists"
                  else
                    ui.msg "Generating node config '#{node_config}'..."
            Severity: Minor
            Found in lib/knife-solo/node_config_command.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 run_command has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def run_command(command, output = nil)
                  result = ExecResult.new
            
                  session.open_channel do |channel|
                    channel.request_pty
            Severity: Minor
            Found in lib/knife-solo/ssh_connection.rb - About 1 hr to fix

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

                    def cook
                      cmd = "sudo chef-solo -c #{provisioning_path}/solo.rb -j #{provisioning_path}/dna.json"
                      cmd << " -l debug" if debug?
                      cmd << " -N #{config[:chef_node_name]}" if config[:chef_node_name]
                      cmd << " -W" if config[:why_run]
              Severity: Minor
              Found in lib/chef/knife/solo_cook.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

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

                  def distro
                    return @distro if @distro
                    @distro = case issue
                    when %r{Debian GNU/Linux [6789]}
                      {:type => (x86? ? "debianoid_omnibus" : "debianoid_gem")}
              Severity: Minor
              Found in lib/knife-solo/bootstraps/linux.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 ssh_args has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def ssh_args
                    args = []
              
                    args << [user, host].compact.join('@')
              
              
              Severity: Minor
              Found in lib/knife-solo/ssh_command.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 connection_options has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def connection_options
                    options = config_file_options
                    options[:port] = config[:ssh_port] if config[:ssh_port]
                    options[:password] = config[:ssh_password] if config[:ssh_password]
                    options[:keys] = [identity_file] if identity_file
              Severity: Minor
              Found in lib/knife-solo/ssh_command.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 validate_ssh_options! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def validate_ssh_options!
                    if config[:identity_file]
                      ui.warn '`--identity-file` is deprecated, please use `--ssh-identity-file`.'
                    end
                    unless first_cli_arg_is_a_hostname?
              Severity: Minor
              Found in lib/knife-solo/ssh_command.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 upload_to_provision_path has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                    def upload_to_provision_path(src, dest, key_name = 'path')
                      if src.is_a? Symbol
                        key_name = src.to_s
                        src = Chef::Config[src]
                      end
              Severity: Minor
              Found in lib/chef/knife/solo_cook.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

              Severity
              Category
              Status
              Source
              Language