Showing 3 of 3 total issues
Method record_citation
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def record_citation
(params[:id].nil?) ? [] :
params[:id].collect do |id|
record = CiteroEngine.acts_as_citable_class.find_by_id id if CiteroEngine.acts_as_citable_class.respond_to? :find_by_id
(record.nil?) ? (raise(ArgumentError, "This ID cannot be found.")) : record
- 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 callback
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def callback
# Starts with current url minus the querystring..
callback = "#{export_citations_url.gsub(/https?/, @push_to.callback_protocol.to_s)}?"
resource_keys = []
citations.each do |citation|
- 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 whitelist_formats
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def whitelist_formats direction, format
# if the params are nil then it returns nil
if direction.nil? || format.nil?
return
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"