Showing 146 of 184 total issues
Method user_has_permission?
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.user_has_permission?(api, to, on, section, options={})
Method require_ability_to
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.require_ability_to(api, to, on, section, options={})
Method api_has_permission?
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.api_has_permission?(api, to, on, section, options={})
Method send_sms
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.send_sms(api, section, members, source_address, message)
Method fetch_from_osm
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.fetch_from_osm(api, section_id, email_id, member_id=nil, email_address='')
Method update_stock
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.update_stock(api, section, badge_id, badge_level=1, stock_level)
Method get_for_section
has a Cognitive Complexity of 7 (exceeds 5 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
- 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 myscout_link_key
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def myscout_link_key(api)
raise Osm::ObjectIsInvalid, 'member is invalid' unless valid?
require_ability_to(api, :read, :member, section_id)
raise Osm::Error, 'the member does not already exist in OSM' if id.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 fetch_from_osm
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.fetch_from_osm(api, section_id, email_id, member_id=nil, email_address='')
Osm::Model.require_access_to_section(api, section_id)
data = api.perform_query("ext/settings/emails/?action=getSentEmail§ion_id=#{section_id}&email_id=#{email_id}&email=#{email_address}&member_id=#{member_id}")
fail Osm::Error, "Unexpected format for response - got a #{data.class}" unless data.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 delete
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def delete(api)
require_ability_to(api, :write, :flexi, flexi_record.section_id)
raise Osm::Forbidden, 'this column is not editable' unless self.editable
data = api.perform_query("extras.php?action=deleteColumn§ionid=#{flexi_record.section_id}&extraid=#{flexi_record.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_badges_for_section
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.get_badges_for_section(api, section, section_type=nil, options={})
raise Error, 'This method must be called on one of the subclasses (CoreBadge, ChallengeBadge, StagedBadge or ActivityBadge)' if type.nil?
require_ability_to(api, :read, :badge, section, options)
section = Osm::Section.get(api, section, options) unless section.is_a?(Osm::Section)
section_type ||= section.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 get_data_for_section
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_data_for_section(api, section, term=nil, options={})
raise Error, 'This method must be called on one of the subclasses (CoreBadge, ChallengeBadge, StagedBadge or ActivityBadge)' if type.nil?
Osm::Model.require_ability_to(api, :read, :badge, section, options)
section = Osm::Section.get(api, section, options) unless section.is_a?(Osm::Section)
term_id = (term.nil? ? Osm::Term.get_current_term_for_section(api, section, options) : term).to_i
- 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 myscout_link
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def myscout_link(api, link_to=:badges, item_id=nil)
raise Osm::ObjectIsInvalid, 'member is invalid' unless valid?
require_ability_to(api, :read, :member, section_id)
raise Osm::Error, 'the member does not already exist in OSM' if id.nil?
raise Osm::ArgumentIsInvalid, 'link_to is invalid' unless [:payments, :events, :programme, :badges, :notice, :details, :census, :giftaid].include?(link_to)
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def self.create(api, options={})
raise ArgumentError, ":section can't be nil" if options[:section].nil?
raise ArgumentError, ":name can't be nil" if options[:name].nil?
raise ArgumentError, ":start can't be nil" if options[:start].nil?
raise ArgumentError, ":finish can't be nil" if options[:finish].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_audit_trail
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_audit_trail(api, options={})
require_ability_to(api, :read, :events, event.section_id, options)
cache_key = ['event\_attendance\_audit', event.id, member_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 get_photo
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_photo(api, black_and_white=!current?, options={})
raise Osm::ObjectIsInvalid, 'member is invalid' unless valid?
require_ability_to(api, :read, :member, section_id)
raise Osm::Error, 'the member does not already exist in OSM' if id.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_emails_for_contacts
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.get_emails_for_contacts(api, section, contacts, members)
# Convert contacts into OSM's format
contacts = [*contacts]
fail ArgumentError, "You must pass at least one contact" if contacts.none?
contact_group_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 get_for_section
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.get_for_section(api, section, options={})
Osm::Model.require_access_to_section(api, section, options)
section_id = section.to_i
cache_key = ['email_delivery_reports', 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_template
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.get_template(api, section, id, options={})
fail ArgumentError, "Invalid template ID: #{id.inspect}" unless VALID_TEMPLATE_IDS.include?(id)
section_id = section.to_i
require_ability_to(api, :read, :user, section, options)
- 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 add_badge_link
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def add_badge_link(api, link)
raise Osm::ObjectIsInvalid, 'link is invalid' unless link.valid?
data = api.perform_query("ext/badges/records/index.php?action=linkBadgeToItem§ionid=#{section_id}", {
'section' => link.badge_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"