chef/vagrant-omnibus

View on GitHub

Showing 6 of 6 total issues

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

        def install(version, env)
          shell_escaped_version = Shellwords.escape(version)

          @machine.communicate.tap do |comm|
            unless windows_guest?
Severity: Minor
Found in lib/vagrant-omnibus/action/install_chef.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

Class InstallChef has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

      class InstallChef
        def initialize(app, env)
          @app = app
          @logger =
            Log4r::Logger.new("vagrantplugins::omnibus::action::installchef")
Severity: Minor
Found in lib/vagrant-omnibus/action/install_chef.rb - About 2 hrs to fix

    Method fetch_or_create_install_script has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def fetch_or_create_install_script(env)
              @script_tmp_path = env[:tmp_path].join(
                "#{Time.now.to_i}-#{install_script_name}"
              ).to_s
    
    
    Severity: Minor
    Found in lib/vagrant-omnibus/action/install_chef.rb - About 1 hr to fix

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

              def recover(env)
                if @script_tmp_path && File.exist?(@script_tmp_path)
                  # Try extra hard to unlink the file so that it reliably works
                  # on Windows hosts as well, see:
                  # http://alx.github.io/2009/01/27/ruby-wundows-unlink.html
      Severity: Minor
      Found in lib/vagrant-omnibus/action/install_chef.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 call has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              def call(env)
                @app.call(env)
      
                return unless @machine.communicate.ready? && provision_enabled?(env)
      
      
      Severity: Minor
      Found in lib/vagrant-omnibus/action/install_chef.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

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

              def installed_version
                version = nil
                opts = communication_opts
                opts[:error_check] = false if windows_guest?
                command = "echo $(chef-solo -v)"
      Severity: Minor
      Found in lib/vagrant-omnibus/action/install_chef.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