matschaffer/knife-solo

View on GitHub
lib/chef/knife/solo_cook.rb

Summary

Maintainability
C
1 day
Test Coverage

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

    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 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

      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 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

      There are no issues that match your filters.

      Category
      Status