Showing 52 of 64 total issues
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 = ""
- Read upRead up
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 = {}
- Read upRead up
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
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 = ""
File cli.rb
has 322 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "mixlib/cli"
require "ffi_yajl"
require "yaml"
require "spiceweasel/command_helper"
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\}\}/, "{}")
- Read upRead up
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 = {}
Method do_flattened_environments
has a Cognitive Complexity of 14 (exceeds 5 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}")
- Read upRead up
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_cookbooks
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def validate_cookbooks(cookbooks)
c_names = []
cookbooks.each do |cookbook|
name = cookbook.keys.first
if cookbook[name]
- Read upRead up
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 role_run_list
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def role_run_list(c_role, cookbooks, role, roles)
c_role.run_list.each do |runlist_item|
if runlist_item.recipe?
Spiceweasel::Log.debug("recipe: #{runlist_item.name}")
cookbook, _recipe = runlist_item.name.split("::")
- Read upRead up
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_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]
- Read upRead up
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\}\}/, "{}")
Method parse_and_validate_input
has 34 lines of code (exceeds 25 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."
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
- Read upRead up
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 unwind_roles
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def unwind_roles(cookbooks, environments, flatroles, rolefiles)
flatroles.each do |role|
Spiceweasel::Log.debug("role: #{role}")
if File.directory?("roles")
# expand wildcards and push into flatroles
- Read upRead up
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
- Read upRead up
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_manifest
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_manifest(manifest)
do_not_validate = Spiceweasel::Config[:novalidation]
berksfile = nil
berksfile = Berksfile.new(manifest["berksfile"]) if manifest.include?("berksfile")
if berksfile
Method initialize
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def initialize(knives = {}, allknifes = [])
@create = []
return unless knives
- Read upRead up
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
- Read upRead up
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 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(berkshelf = nil)
@create = []
@delete = []
@cookbook_list = {}
# only load berkshelf if we are going to use it