Showing 146 of 184 total issues
File badge.rb
has 619 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Osm
class Badge < Osm::Model
class Requirement; end # Ensure the constant exists for the validators
class RequirementModule; end # Ensure the constant exists for the validators
File event.rb
has 614 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Osm
class Event < Osm::Model
class BadgeLink < Osm::Model; end # Ensure the constant exists for the validators
class Column < Osm::Model; end # Ensure the constant exists for the validators
Method get_for_section
has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring. Open
def self.get_for_section(api, section, term=nil, options={})
require_ability_to(api, :read, :member, section, options)
if term.nil?
section = Osm::Section.get(api, section) if section.is_a?(Fixnum)
term = section.waiting? ? -1 : Osm::Term.get_current_term_for_section(api, 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
File member.rb
has 550 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Osm
class Member < Osm::Model
# Constants for group id
GID_PRIMARY_CONTACT = 1
Method update
has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring. Open
def update(api)
require_ability_to(api, :write, :events, section_id)
updated = true
# Update main attributes
- 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 144 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.get_for_section(api, section, term=nil, options={})
require_ability_to(api, :read, :member, section, options)
if term.nil?
section = Osm::Section.get(api, section) if section.is_a?(Fixnum)
term = section.waiting? ? -1 : Osm::Term.get_current_term_for_section(api, section)
Method earnt?
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def earnt?
if badge.has_levels?
return earnt > awarded
else
return false if (due.eql?(1) && awarded.eql?(1))
- 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 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_all
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def self.get_all(api, options={})
cache_key = ['sections', api.user_id]
if !options[:no_cache] && cache_exist?(api, cache_key)
ids = cache_read(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 get_data
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def get_data(api, term=nil, options={})
require_ability_to(api, :read, :flexi, section_id, options)
section = Osm::Section.get(api, self.section_id)
term_id = term.nil? ? Osm::Term.get_current_term_for_section(api, section).id : term.to_i
cache_key = ['flexi_record_data', 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 started
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def started
unless badge.has_levels?
return started? ? 1 : 0
end
unless badge.show_level_letters
- 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 28 (exceeds 5 allowed). Consider refactoring. Open
def self.create(api, parameters)
require_ability_to(api, :write, :events, parameters[:section_id])
event = new(parameters)
raise Osm::ObjectIsInvalid, 'event is invalid' unless event.valid?
- 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 validate_each
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def validate_each(record, attribute, value)
record.errors.add(attribute, 'must be a Hash') unless value.is_a?(Hash)
value.each do |k, v|
if options[:key_type]
- 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 perform_query
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def self.perform_query(site, url, api_data={}, raw=false)
raise ArgumentError, 'site is invalid, this should be set to either :osm or :ogm' unless Osm::Api::BASE_URLS.keys.include?(site)
data = api_data.merge({
'apiid' => @@api_details[site][: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_attendance
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def self.get_attendance(api, section, term=nil, options={})
Osm::Model.require_ability_to(api, :read, :register, 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 = ['register_attendance', 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
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def self.get(api, activity_id, version=nil, options={})
cache_key = ['activity', activity_id]
if !options[:no_cache] && cache_exist?(api, [*cache_key, version])
activity = cache_read(api, [*cache_key, version])
- 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
File online_payment.rb
has 305 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Osm
class OnlinePayment
class Schedule < Osm::Model
Method get_for_section
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def self.get_for_section(api, section, term=nil, options={})
require_ability_to(api, :read, :programme, 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 = ['programme', 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 a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def update(api)
raise Osm::ObjectIsInvalid, 'data is invalid' unless valid?
require_ability_to(api, :write, :flexi, flexi_record.section_id)
term_id = Osm::Term.get_current_term_for_section(api, flexi_record.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 update
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update(api)
require_ability_to(api, :write, :events, section_id)
updated = true
# Update main attributes