mattray/spiceweasel

View on GitHub

Showing 52 of 64 total issues

Method do_flattened_environments has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def do_flattened_environments(cookbooks, environments)
      flatenvs = environments.map(&:keys).flatten
      envfiles = []
      flatenvs.each do |env|
        Spiceweasel::Log.debug("environment: #{env}")
Severity: Minor
Found in lib/spiceweasel/environments.rb - About 1 hr to fix

    Method resolve_cookbooks has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def self.resolve_cookbooks(berkshelf_cookbooks = {})
          require "solve"
          loader = Chef::CookbookLoader.new(Spiceweasel::Config[:cookbook_dir])
          loader.load_cookbooks
          books = loader.cookbooks_by_name
    Severity: Minor
    Found in lib/spiceweasel/extract_local.rb - About 1 hr to fix

      Method parse_and_validate_options has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def parse_and_validate_options
            ARGV << "-h" if ARGV.empty?
            begin
              parse_options
              # Load knife configuration if using knife config
      Severity: Minor
      Found in lib/spiceweasel/cli.rb - About 1 hr to fix

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

            def cluster_process_nodes(cluster, environment, cookbooks, environments, roles, knifecommands, rootoptions)
              Spiceweasel::Log.debug("cluster::cluster_process_nodes '#{environment}' '#{cluster[environment]}'")
              cluster[environment].each do |node|
                node_name = node.keys.first
                options = node[node_name]["options"] || ""
        Severity: Minor
        Found in lib/spiceweasel/clusters.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 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 validate_metadata_or_get_knife_commands_wrapper has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def validate_metadata_or_get_knife_commands_wrapper(name, options, version)
              if File.directory?("cookbooks")
                if @loader.cookbooks_by_name[name]
                  validate_metadata(name, version) unless Spiceweasel::Config[:novalidation]
                else
        Severity: Minor
        Found in lib/spiceweasel/cookbooks.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 parse_and_validate_input has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def parse_and_validate_input(file) # rubocop:disable CyclomaticComplexity
              begin
                Spiceweasel::Log.debug("file: #{file}")
                unless File.file?(file)
                  STDERR.puts "ERROR: #{file} is an invalid manifest file, please check your path."
        Severity: Minor
        Found in lib/spiceweasel/cli.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 cluster_process_nodes has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def cluster_process_nodes(cluster, environment, cookbooks, environments, roles, knifecommands, rootoptions)
          Severity: Major
          Found in lib/spiceweasel/clusters.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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def initialize(clusters, cookbooks, environments, roles, knifecommands, rootoptions)
              Severity: Minor
              Found in lib/spiceweasel/clusters.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 parse_objects has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def self.parse_objects # rubocop:disable CyclomaticComplexity
                            objects = {}
                      
                            # BERKSHELF
                            berksfile = parse_berkshelf(objects)
                      Severity: Minor
                      Found in lib/spiceweasel/extract_local.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 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 evaluate_configuration has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def evaluate_configuration(create, delete, manifest)
                              case
                              when Spiceweasel::Config[:extractjson]
                                puts JSON.pretty_generate(manifest)
                              when Spiceweasel::Config[:extractyaml]
                        Severity: Minor
                        Found in lib/spiceweasel/cli.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 do_execute_rebuild has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def do_execute_rebuild(create, delete)
                              if Spiceweasel::Config[:execute]
                                Execute.new(delete)
                                Execute.new(create)
                              else
                        Severity: Minor
                        Found in lib/spiceweasel/cli.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 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
                            Severity
                            Category
                            Status
                            Source
                            Language