Showing 146 of 184 total issues
Method create
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def create(api)
raise Osm::Error, 'the budget already exists in OSM' unless id.nil?
raise Osm::ObjectIsInvalid, 'budget is invalid' unless valid?
Osm::Model.require_ability_to(api, :write, :finance, section_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_list
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.get_list(api, section, options={})
require_ability_to(api, :read, :events, section, options)
section_id = section.to_i
cache_key = ['events_list', section_id]
events_cache_key = ['events', section_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 create
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def create(api)
raise Osm::Error, 'the member already exists in OSM' unless id.nil?
raise Osm::ObjectIsInvalid, 'member is invalid' unless valid?
require_ability_to(api, :write, :member, section_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_for_section
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.get_for_section(api, section, options={})
require_ability_to(api, :read, :finance, section, options)
section_id = section.to_i
cache_key = ['invoice_ids', section_id]
invoices = nil
Method started
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def started
unless badge.has_levels?
return started? ? 1 : 0
end
unless badge.show_level_letters
Method get_osm_error
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.get_osm_error(data)
return false unless data.is_a?(Hash)
return false if data['ok']
to_return = data['error'] || data['err'] || false
if to_return.is_a?(Hash)
- 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 a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def update(api)
raise Osm::ObjectIsInvalid, 'column is invalid' unless valid?
require_ability_to(api, :write, :flexi, flexi_record.section_id)
raise Osm::Forbidden, 'this column is not editable' unless self.editable
- 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_all
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.get_all(api, section, options={})
section_id = section.to_i
cache_key = ['api_access', api.user_id, section_id]
if !options[:no_cache] && cache_exist?(api, cache_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 update
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def update(api, member, force=false)
raise Osm::ObjectIsInvalid, 'member is invalid' unless valid?
require_ability_to(api, :write, :member, member.section_id)
attribute_map = {
- 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 send_email
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.send_email(api, section, send_to, cc='', from, subject, body)
Method update
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update(api)
raise Osm::ObjectIsInvalid, 'meeting is invalid' unless valid?
require_ability_to(api, :write, :programme, section_id)
activities_data = Array.new
- 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_template
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.update_template(api, section, id, content)
fail ArgumentError, "Invalid template ID: #{id.inspect}" unless VALID_TEMPLATE_IDS.include?(id)
section_id = section.to_i
require_ability_to(api, :write, :user, section)
- 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_from_ids
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.get_from_ids(api, ids, key, arguments=[], options, get_all_method)
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"
Further reading
Method get_user_roles!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_user_roles!(options={})
cache_key = ['user_roles', @user_id]
if !options[:no_cache] && Osm::Model.cache_exist?(self, cache_key)
return Osm::Model.cache_read(self, cache_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 create
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create(api)
raise Osm::Error, 'the invoice item already exists in OSM' unless id.nil?
raise Osm::ObjectIsInvalid, 'invoice item is invalid' unless valid?
Osm::Model.require_ability_to(api, :write, :finance, invoice.section_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 <=>
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def <=>(another)
result = self.flexi_record <=> another.try(:flexi_record)
if result == 0
if id.match(/\Af_\d+\Z/)
# This is a user column
- 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
Consider simplifying this complex logical expression. Open
if force || changed_attributes.include?('gender')
new_value = {male: 'Male', female: 'Female', other: 'Other'}[gender] || 'Unspecified'
data = api.perform_query("ext/customdata/?action=updateColumn§ion_id=#{section_id}", {
'associated_id' => self.id,
'associated_type' => 'member',
Method has_permission?
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.has_permission?(api, to, on, section, options={})
Method require_permission
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.require_permission(api, to, on, section, options={})