Showing 52 of 64 total issues
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
- 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
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate(environment, cookbooks) # rubocop:disable CyclomaticComplexity
env = nil
file = %W{environments/#{environment}.rb environments/#{environment}.json}.find { |f| File.exist?(f) }
environment = environment.split("/").last if environment =~ /\// # pull out directories
if file
- 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 invoke_validate_item
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def invoke_validate_item(db, items, secret)
items = [] if items.nil?
Spiceweasel::Log.debug("data bag: #{db} #{secret} #{items}")
items.each do |item|
Spiceweasel::Log.debug("data bag #{db} item: #{item}")
- 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 parse_and_validate_options
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse_and_validate_options
ARGV << "-h" if ARGV.empty?
begin
parse_options
# Load knife configuration if using knife config
- 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 a Cognitive Complexity of 6 (exceeds 5 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
- 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 find_manifest
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def find_manifest
ARGV.each do |arg|
if arg =~ /\.json$|\.rb$|\.yml$/
return arg unless ARGV[ARGV.find_index(arg) - 1].eql?("--cluster-file")
end
- 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 parse_data_bags
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.parse_data_bags
data_bags = []
Dir.glob("data_bags/*").each do |data_bag_full_path|
next unless File.directory?(data_bag_full_path)
data_bag = data_bag_full_path.split("/").last
- 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
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate(role, _environments, cookbooks, roles) # rubocop:disable CyclomaticComplexity
# validate the role passed in match the name of either the .rb or .json
file = %W{roles/#{role}.rb roles/#{role}.json}.find { |f| File.exist?(f) }
role = role.split("/").last if role =~ /\// # pull out directories
if file
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize(commands)
# for now we're shelling out
commands.each do |cmd|
Spiceweasel::Log.debug("Command will timeout after #{Spiceweasel::Config[:cmd_timeout]} seconds.")
knife = Mixlib::ShellOut.new(cmd.command, cmd.shellout_opts.merge(live_stream: STDOUT, timeout: Spiceweasel::Config[:timeout].to_i))
- 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 evaluate_c_role
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def evaluate_c_role(file)
c_role = nil
case file
when /\.json$/
c_role = Chef::JSONCompat.from_json(IO.read(file))
- 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_only
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process_only(manifest)
only_list = Spiceweasel::Config[:only]
return manifest if only_list.empty?
only_list.each do |key|
unless MANIFEST_OPTIONS.member?(key)
- 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_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)
- 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"