Showing 1,006 of 6,062 total issues
Method help_sections
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def help_sections
content = Hashie::Mash.new.tap do |elements|
Rails.root.join("config", "docs").children.each do |file|
next unless file.extname == ".yml"
- 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 release
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def release
logger.debug("Release #{name} lock enter: #{@file.inspect}")
if @file
@file.flock(File::LOCK_UN) if locked?
@file.close unless @file.closed?
- 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 export_supportconfig
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def export_supportconfig
begin
base = "supportconfig-#{Time.now.strftime("%Y%m%d-%H%M%S")}"
filename = "#{base}.tbz"
- 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 render_barclamp_edit_attributes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def render_barclamp_edit_attributes(proposal)
if show_raw_attributes?
render partial: "barclamp/edit_attributes_raw"
else
if Rails.root.join("app", "views", "barclamp", proposal.barclamp, "_edit_attributes.html.haml").file?
- 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 save
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def save(group, instance, barclamp, config)
with_lock "config-#{group}" do
data_bag_item = databag_config(group)
data_bag_item[instance] ||= {}
if data_bag_item[instance][barclamp] != config
- 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 proposal_list
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def proposal_list
struct = get_json("/proposals/")
if struct[1] != 200
["Failed to talk to service proposal list: #{struct[1]}: #{struct[0]}", 1]
- 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 bios_raid_options
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def bios_raid_options
# read in default proposal, to make some vaules avilable
proposal = Proposal.where(barclamp: "crowbar").first
raise "Can't find the crowbar proposal" if proposal.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
Method method_missing
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def method_missing(method_name, *args)
if (match = method_name.to_s.match(/(.*)=$/)) && args.size == 1
self[match[1]] = args.first
elsif (match = method_name.to_s.match(/(.*)\?$/)) && args.size == 0
key?(match[1])
- 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 dequeue_proposal_no_lock
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def dequeue_proposal_no_lock(bc, inst)
logger.debug("dequeue_proposal_no_lock: enter for #{bc}:#{inst}")
begin
# Find the proposal to delete, get its elements (nodes)
item = ProposalQueue.find_by(barclamp: bc, name: inst)
- 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 platform_available?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def platform_available?(platform, arch)
available = true
repositories(platform, arch).each do |repo|
r = new(platform, arch, repo)
- 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 list
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def list
struct = get_json("/")
if struct[1] != 200
["Failed to talk to service list: #{struct[1]}: #{struct[0]}", 1]
- 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 authenticate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def authenticate(req, uri, data = nil, limit = 10)
uri.user = @username
uri.password = @password
h = Net::HTTP.new uri.host, uri.port
- 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 elements
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def elements
struct = get_json("/elements")
if struct[1] != 200
["Failed to talk to service elements: #{struct[1]}: #{struct[0]}", 1]
- 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 save_selected_upgrade_mode
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def save_selected_upgrade_mode(mode)
::Crowbar::Lock::LocalBlocking.with_lock(shared: false, logger: @logger, path: lock_path) do
load_while_locked
# It's ok to change the upgrade mode until starting the services step
unless pending? :services
- 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 elements_not_ready
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def elements_not_ready(nodes, pre_cached_nodes = {})
# Check to see if we should delay our commit until nodes are ready.
delay = []
nodes.each do |n|
pre_cached_nodes[n] ||= Node.find_by_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
Avoid too many return
statements within this function. Open
return ret("operator", null, stream.current());
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
if (type == "default") return cont(expect(":"));
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
if (type == "operator") return cont(expression);
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return cont();
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
if (type == "[") return cont(pushlex("]"), expression, expect("]"), poplex, maybeoperator);
- Create a ticketCreate a ticket