Method update
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def update(api)
raise Osm::ObjectIsInvalid, 'data is invalid' unless valid?
require_ability_to(api, :write, :finance, section_id)
term_id = Osm::Term.get_current_term_for_section(api, section_id).id
- 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 get_data
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def self.get_data(api, section, term=nil, options={})
Osm::Model.require_ability_to(api, :read, :finance, section, options)
section_id = section.to_i
term_id = term.nil? ? Osm::Term.get_current_term_for_section(api, section).id : term.to_i
cache_key = ['gift_aid_data', section_id, term_id]
- 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 update
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update(api)
raise Osm::ObjectIsInvalid, 'data is invalid' unless valid?
require_ability_to(api, :write, :finance, section_id)
term_id = Osm::Term.get_current_term_for_section(api, section_id).id
Method get_donations
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.get_donations(api, section, term=nil, options={})
Osm::Model.require_ability_to(api, :read, :finance, section, options)
section_id = section.to_i
term_id = term.nil? ? Osm::Term.get_current_term_for_section(api, section).id : term.to_i
cache_key = ['gift_aid_donations', section_id, term_id]
- 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 get_data
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.get_data(api, section, term=nil, options={})
Osm::Model.require_ability_to(api, :read, :finance, section, options)
section_id = section.to_i
term_id = term.nil? ? Osm::Term.get_current_term_for_section(api, section).id : term.to_i
cache_key = ['gift_aid_data', section_id, term_id]
Method update_donation
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.update_donation(data={})
raise Osm::ArgumentIsInvalid, ':section is missing' if data[:section].nil?
raise Osm::ArgumentIsInvalid, ':donation_date is missing' if data[:donation_date].nil?
raise Osm::ArgumentIsInvalid, ':amount is missing' if data[:amount].nil?
raise Osm::ArgumentIsInvalid, ':note is missing' if data[:note].nil?
- 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"