mattray/spiceweasel

View on GitHub
lib/spiceweasel/nodes.rb

Summary

Maintainability
F
1 wk
Test Coverage

Method process_chef_client has a Cognitive Complexity of 126 (exceeds 5 allowed). Consider refactoring.
Open

    def process_chef_client(names, options, run_list) # rubocop:disable CyclomaticComplexity
      commands = []
      environment = nil
      protocol = "ssh"
      protooptions = ""
Severity: Minor
Found in lib/spiceweasel/nodes.rb - About 2 days 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 initialize has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(nodes, cookbooks, environments, roles, knifecommands, rootoptions) # rubocop:disable CyclomaticComplexity
      @create = []
      @delete = []
      chefclient = []
      create_command_options = {}
Severity: Minor
Found in lib/spiceweasel/nodes.rb - About 1 day 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 nodes.rb has 424 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Spiceweasel
  # manages parsing of Nodes
  class Nodes
    include CommandHelper

Severity: Minor
Found in lib/spiceweasel/nodes.rb - About 6 hrs to fix

    Method process_chef_client has 125 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def process_chef_client(names, options, run_list) # rubocop:disable CyclomaticComplexity
          commands = []
          environment = nil
          protocol = "ssh"
          protooptions = ""
    Severity: Major
    Found in lib/spiceweasel/nodes.rb - About 5 hrs to fix

      Method process_parallel has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          def process_parallel(count, create_command_options, name, options, provider, run_list)
            parallel = "seq #{count} | parallel -u -j 0 -v -- "
            if provider.eql?("vsphere")
              if bundler?
                parallel += "bundle exec knife #{provider}#{Spiceweasel::Config[:knife_options]} vm clone #{options}".gsub(/\{\{n\}\}/, "{}")
      Severity: Minor
      Found in lib/spiceweasel/nodes.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 initialize has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def initialize(nodes, cookbooks, environments, roles, knifecommands, rootoptions) # rubocop:disable CyclomaticComplexity
            @create = []
            @delete = []
            chefclient = []
            create_command_options = {}
      Severity: Major
      Found in lib/spiceweasel/nodes.rb - About 2 hrs to fix

        Method validate_run_list has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def validate_run_list(node, run_list, cookbooks, roles)
              run_list.split(",").each do |item|
                if item.start_with?("recipe[")
                  # recipe[foo] or recipe[foo::bar]
                  cb = item.split(/\[|\]/)[1].split(":")[0]
        Severity: Minor
        Found in lib/spiceweasel/nodes.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 process_parallel has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def process_parallel(count, create_command_options, name, options, provider, run_list)
              parallel = "seq #{count} | parallel -u -j 0 -v -- "
              if provider.eql?("vsphere")
                if bundler?
                  parallel += "bundle exec knife #{provider}#{Spiceweasel::Config[:knife_options]} vm clone #{options}".gsub(/\{\{n\}\}/, "{}")
        Severity: Minor
        Found in lib/spiceweasel/nodes.rb - About 1 hr to fix

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

              def process_providers(names, count, name, options, run_list, create_command_options, knifecommands) # rubocop:disable CyclomaticComplexity
                provider = names[0]
                validate_provider(provider, names, count, options, knifecommands) unless Spiceweasel::Config[:novalidation]
                provided_names = []
                if name.nil? && options.split.index("-N") # pull this out for deletes
          Severity: Minor
          Found in lib/spiceweasel/nodes.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 node_names_flatten has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def node_names_flatten(create_command_options, node, run_list)
                if File.directory?("nodes/")
                  if File.exist?("nodes/#{node}.json")
                    validate_node_file(node) unless Spiceweasel::Config[:novalidation]
                    servercommand = "knife node from file #{node}.json #{Spiceweasel::Config[:knife_options]}".rstrip
          Severity: Minor
          Found in lib/spiceweasel/nodes.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 do_bulk_delete has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def do_bulk_delete(provider)
                if ["kvm", "vsphere"].member?(provider)
                  if bundler?
                    delete_command("knife node#{Spiceweasel::Config[:knife_options]} list | xargs bundle exec knife #{provider} vm delete -y")
                  else
          Severity: Minor
          Found in lib/spiceweasel/nodes.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 determine_cloud_provider has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def determine_cloud_provider(count, create_command_options, name, options, provider, run_list)
                count.to_i.times do |i|
                  if provider.eql?("vsphere")
                    server = node_numerate("knife #{provider}#{Spiceweasel::Config[:knife_options]} vm clone #{options}", i + 1, count)
                  elsif provider.eql?("kvm")
          Severity: Minor
          Found in lib/spiceweasel/nodes.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 process_providers has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def process_providers(names, count, name, options, run_list, create_command_options, knifecommands) # rubocop:disable CyclomaticComplexity
          Severity: Major
          Found in lib/spiceweasel/nodes.rb - About 50 mins to fix

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

                def initialize(nodes, cookbooks, environments, roles, knifecommands, rootoptions) # rubocop:disable CyclomaticComplexity
            Severity: Minor
            Found in lib/spiceweasel/nodes.rb - About 45 mins to fix

              Method determine_cloud_provider has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def determine_cloud_provider(count, create_command_options, name, options, provider, run_list)
              Severity: Minor
              Found in lib/spiceweasel/nodes.rb - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                        if bundler?
                          parallel += "bundle exec knife #{provider}#{Spiceweasel::Config[:knife_options]} server create #{options}".gsub(/\{\{n\}\}/, "{}")
                        else
                          parallel += "knife #{provider}#{Spiceweasel::Config[:knife_options]} server create #{options}".gsub(/\{\{n\}\}/, "{}")
                        end
                Severity: Major
                Found in lib/spiceweasel/nodes.rb - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                          if bundler?
                            parallel += "bundle exec knife #{provider}#{Spiceweasel::Config[:knife_options]} server create #{name} #{options}".gsub(/\{\{n\}\}/, "{}")
                          else
                            parallel += "knife #{provider}#{Spiceweasel::Config[:knife_options]} server create #{name} #{options}".gsub(/\{\{n\}\}/, "{}")
                          end
                  Severity: Major
                  Found in lib/spiceweasel/nodes.rb - About 45 mins to fix

                    Method process_parallel has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def process_parallel(count, create_command_options, name, options, provider, run_list)
                    Severity: Minor
                    Found in lib/spiceweasel/nodes.rb - About 45 mins to fix

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

                          def do_google_numeric_provider(create_command_options, names, options, provided_names, run_list)
                      Severity: Minor
                      Found in lib/spiceweasel/nodes.rb - About 35 mins to fix

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

                            def validate_provider(provider, names, _count, options, knifecommands)
                        Severity: Minor
                        Found in lib/spiceweasel/nodes.rb - About 35 mins to fix

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

                              def validate_provider(provider, names, _count, options, knifecommands)
                                unless knifecommands.index { |x| x.start_with?("knife #{provider}") }
                                  STDERR.puts "ERROR: 'knife #{provider}' is not a currently installed plugin for knife."
                                  exit(-1)
                                end
                          Severity: Minor
                          Found in lib/spiceweasel/nodes.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 process_nodes_only has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def process_nodes_only(names, options, run_list, create_command_options) # rubocop:disable CyclomaticComplexity
                                nodenames = []
                                if PROVIDERS.member?(names[0])
                                  count = names.length == 2 ? names[1] : 1
                                  do_provider_members(count, nodenames, options)
                          Severity: Minor
                          Found in lib/spiceweasel/nodes.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

                          Similar blocks of code found in 4 locations. Consider refactoring.
                          Open

                                    parallel += "bundle exec knife #{provider}#{Spiceweasel::Config[:knife_options]} vm clone #{options}".gsub(/\{\{n\}\}/, "{}")
                                  else
                                    parallel += "knife #{provider}#{Spiceweasel::Config[:knife_options]} vm clone #{options}".gsub(/\{\{n\}\}/, "{}")
                                  end
                          Severity: Major
                          Found in lib/spiceweasel/nodes.rb and 3 other locations - About 35 mins to fix
                          lib/spiceweasel/nodes.rb on lines 293..296
                          lib/spiceweasel/nodes.rb on lines 299..302
                          lib/spiceweasel/nodes.rb on lines 311..314

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 36.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 4 locations. Consider refactoring.
                          Open

                                    parallel += "bundle exec knife #{provider}#{Spiceweasel::Config[:knife_options]} server create #{options}".gsub(/\{\{n\}\}/, "{}")
                                  else
                                    parallel += "knife #{provider}#{Spiceweasel::Config[:knife_options]} server create #{options}".gsub(/\{\{n\}\}/, "{}")
                                  end
                          Severity: Major
                          Found in lib/spiceweasel/nodes.rb and 3 other locations - About 35 mins to fix
                          lib/spiceweasel/nodes.rb on lines 287..290
                          lib/spiceweasel/nodes.rb on lines 293..296
                          lib/spiceweasel/nodes.rb on lines 299..302

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 36.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 4 locations. Consider refactoring.
                          Open

                                    parallel += "bundle exec knife #{provider}#{Spiceweasel::Config[:knife_options]} droplet create #{options}".gsub(/\{\{n\}\}/, "{}")
                                  else
                                    parallel += "knife #{provider}#{Spiceweasel::Config[:knife_options]} droplet create #{options}".gsub(/\{\{n\}\}/, "{}")
                                  end
                          Severity: Major
                          Found in lib/spiceweasel/nodes.rb and 3 other locations - About 35 mins to fix
                          lib/spiceweasel/nodes.rb on lines 287..290
                          lib/spiceweasel/nodes.rb on lines 293..296
                          lib/spiceweasel/nodes.rb on lines 311..314

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 36.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 4 locations. Consider refactoring.
                          Open

                                  if opt =~ /^-i|^--identity-file/
                                    if opt =~ /^-i$|^--identity-file$/
                                      value = "-i"
                                    else
                                      opt.sub!(/-i/, "") if opt =~ /^-i/
                          Severity: Major
                          Found in lib/spiceweasel/nodes.rb and 3 other locations - About 35 mins to fix
                          lib/spiceweasel/nodes.rb on lines 366..373
                          lib/spiceweasel/nodes.rb on lines 381..388
                          lib/spiceweasel/nodes.rb on lines 396..403

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 36.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 4 locations. Consider refactoring.
                          Open

                                  if opt =~ /^-p|^--ssh-port/
                                    if opt =~ /^-p$|^--ssh-port$/
                                      value = "-p"
                                    else
                                      opt.sub!(/-p/, "") if opt =~ /^-p/
                          Severity: Major
                          Found in lib/spiceweasel/nodes.rb and 3 other locations - About 35 mins to fix
                          lib/spiceweasel/nodes.rb on lines 351..358
                          lib/spiceweasel/nodes.rb on lines 366..373
                          lib/spiceweasel/nodes.rb on lines 381..388

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 36.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 4 locations. Consider refactoring.
                          Open

                                  if opt =~ /^-P|^--ssh-password/
                                    if opt =~ /^-P$|^--ssh-password$/
                                      value = "-P"
                                    else
                                      opt.sub!(/-P/, "") if opt =~ /^-P/
                          Severity: Major
                          Found in lib/spiceweasel/nodes.rb and 3 other locations - About 35 mins to fix
                          lib/spiceweasel/nodes.rb on lines 351..358
                          lib/spiceweasel/nodes.rb on lines 366..373
                          lib/spiceweasel/nodes.rb on lines 396..403

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 36.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 4 locations. Consider refactoring.
                          Open

                                    parallel += "bundle exec knife #{provider}#{Spiceweasel::Config[:knife_options]} vm create #{options}".gsub(/\{\{n\}\}/, "{}")
                                  else
                                    parallel += "knife #{provider}#{Spiceweasel::Config[:knife_options]} vm create #{options}".gsub(/\{\{n\}\}/, "{}")
                                  end
                          Severity: Major
                          Found in lib/spiceweasel/nodes.rb and 3 other locations - About 35 mins to fix
                          lib/spiceweasel/nodes.rb on lines 287..290
                          lib/spiceweasel/nodes.rb on lines 299..302
                          lib/spiceweasel/nodes.rb on lines 311..314

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 36.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 4 locations. Consider refactoring.
                          Open

                                  if opt =~ /^-G|^--ssh-gateway/
                                    if opt =~ /^-G$|^--ssh-gateway$/
                                      value = "-G"
                                    else
                                      opt.sub!(/-G/, "") if opt =~ /^-G/
                          Severity: Major
                          Found in lib/spiceweasel/nodes.rb and 3 other locations - About 35 mins to fix
                          lib/spiceweasel/nodes.rb on lines 351..358
                          lib/spiceweasel/nodes.rb on lines 381..388
                          lib/spiceweasel/nodes.rb on lines 396..403

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 36.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          There are no issues that match your filters.

                          Category
                          Status