Showing 6,062 of 6,062 total issues
Avoid deeply nested control flow statements. Open
if count >= 5
message = "Ran \"#{zypper_command}\" more than five times, and it still requires more runs."
Chef::Log.fatal(message)
node.save # node is always dirty due to one_shot_run
raise message
- Create a ticketCreate a ticket
Method downgrade
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def downgrade(ta, td, a, d)
unless ta["networks"]["nova_floating"].key? "add_ovs_bridge"
a["networks"]["nova_floating"].delete "add_ovs_bridge"
end
unless ta["networks"]["nova_floating"].key? "bridge_name"
- Read upRead up
- Create a ticketCreate a ticket
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
Function ajaxSubmit
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
ajaxSubmit: function (fnBefore, fnSuccess, fnComplete, fnError, previewId, index) {
- Create a ticketCreate a ticket
Method enable_interface
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def enable_interface(bc_instance, network, name)
Rails.logger.debug("Network enable_interface: entering #{name} #{network}")
return [404, "No network specified"] if network.nil?
return [404, "No name specified"] if name.nil?
- Read upRead up
- Create a ticketCreate a ticket
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
Avoid deeply nested control flow statements. Open
if(data) { data.key = key; }
- Create a ticketCreate a ticket
Method get_network_by_type
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.get_network_by_type(node, type)
unless node[:crowbar].nil? || node[:crowbar][:network].nil? ||
node[:network].nil? || node[:network][:networks].nil?
[type, "admin"].uniq.each do |usage|
found = node[:crowbar][:network].find do |net, data|
- Read upRead up
- Create a ticketCreate a ticket
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
Avoid deeply nested control flow statements. Open
if result[0] != 200
Rails.logger.error("Failed to allocate bmc_vlan address for: " \
"#{node.name}: #{result[0]}")
end
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
unless current_url.nil? || current_url.empty?
Chef::Log.info("Removing #{name} zypper repository pointing to wrong URI...")
`zypper --non-interactive removerepo #{name}`
end
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if node[:updater][:do_reboot]
Chef::Log.info("Will reboot node at the end of chef run.")
node.run_state[:reboot] = true
node[:updater][:need_reboot] = false
else
- Create a ticketCreate a ticket
Method new
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.new(nic)
logstr=""
if nic.is_a?(::Nic)
return nic
elsif o = @@interfaces[nic]
- Read upRead up
- Create a ticketCreate a ticket
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 search_env_filtered
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def search_env_filtered(type, query="*:*", sort="X_CHEF_id_CHEF_X asc",
start=0, rows=100, &block)
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if result[0] != 200
Rails.logger.error(
"Failed to allocate bastion address for: #{node.name}: #{result[0]}"
)
else
- Create a ticketCreate a ticket
Method list_networks
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.list_networks(node)
answer = []
unless node[:crowbar].nil? || node[:crowbar][:network].nil? ||
node[:network].nil? || node[:network][:networks].nil?
node[:crowbar][:network].each do |net, data|
- Read upRead up
- Create a ticketCreate a ticket
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 populate_cinder_volumes_with_ses_settings
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def populate_cinder_volumes_with_ses_settings(cinder_controller)
ses_volume_found = false
ses_config = ses_settings
# Loop to check if we have SES managed cluster and update configs
- Read upRead up
- Create a ticketCreate a ticket
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 get_host_for_public_url
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.get_host_for_public_url(node, use_ssl, use_cluster = false,
want_fqdn = false)
if use_cluster && defined?(CrowbarPacemakerHelper)
# loose dependency on the pacemaker cookbook
cluster_vhostname = CrowbarPacemakerHelper.cluster_vhostname(node)
- Read upRead up
- Create a ticketCreate a ticket
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
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.find(nics)
t = Hash.new
nics.each do |n|
n = Nic.coerce(n)
t[n.name]=n
- Read upRead up
- Create a ticketCreate a ticket
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 __nics
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.__nics
res = []
::Dir.entries("/sys/class/net").each do |d|
next if d == "." or d == ".."
next unless ::File.directory?("/sys/class/net/#{d}")
- Read upRead up
- Create a ticketCreate a ticket
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 add_role_to_instance_and_node
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_role_to_instance_and_node(barclamp, instance, name, prop, role, newrole)
- Create a ticketCreate a ticket
Method content
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def content
struct = [].tap do |result|
barclamps.each do |barclamp|
next unless process_barclamp?(
barclamp
- Read upRead up
- Create a ticketCreate a ticket
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 skip_unchanged_node?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def skip_unchanged_node?(node_name, old_role, new_role)
# if old_role is nil, then we are applying the barclamp for the first time
return false if old_role.nil?
# if the servers have changed, we need to apply
- Read upRead up
- Create a ticketCreate a ticket
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"