Showing 15 of 17 total issues
Method submit
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def submit(member, card)
return if card.academic_year != Member.current_academic_year
return if not ['request'].include? card.isic_status
return if card.status != 'paid'
Method submit
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def submit(member, card)
return if card.academic_year != Member.current_academic_year
return if not ['request'].include? card.isic_status
return if card.status != 'paid'
- 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 field_for_extra_attribute_type
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def field_for_extra_attribute_type(f, type)
label = f.object.spec.name
values = f.object.spec.values
case type
Method filter_params
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def filter_params
report_params = { club_id: @club.id }
@filtered = false
if params[:member_report]
# This will check if members are actually filtered
- 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 verify_fk
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def verify_fk
# Development backdoor
return session[:club] = "FK" if Rails.env.development?
if session[:cas].blank? || session[:cas]['user'].blank?
- 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_members
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def add_members(members, academic_year)
return if members.length == 0
club = members.first.club
members.each_with_index do |member, 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 export
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def export
if self.citylife?
self.delay.export_to_citylife unless self.citylife_exported
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"
Further reading
Method photo
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def photo
skip_step unless @member.uses_isic? || (@member.uses_citylife? && ! @member.club.skip_photo_step)
if params[:member]
@member.save # Trigger paperclip callbacks
# All image uploading and processing is done by the model
- 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 pay
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def pay
@card = @member.current_card || Card.build_for(@member)
if params[:card] || params[:commit]
@card.attributes = params[:card] if params[:card]
- 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 request_clubnames
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def request_clubnames
# Development backdoor
return Club.pluck(:internal_name) if Rails.env.development?
ugent_login = session[:cas]['user']
- 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 valid_card_number
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def valid_card_number
return if self.number.blank? or not self.member
return if self.club && self.club.uses_citylife?
# Only check the rules of current cards
- 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 find_member_for_club
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.find_member_for_club(member_id, club)
return [nil, :not_found] unless member_id
member = includes(:current_card).where(:id => member_id, :enabled => true)
if member = member.first
- 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 render_extra_attribute_value
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def render_extra_attribute_value(attribute)
return if attribute.spec.field_type.blank?
if attribute.value.is_a? Array
# Filter out empty values
- 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 photo_dimensions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def photo_dimensions
return unless photo? or not photo.dirty?
# If an exception occurs, its probably not a valid photo
# and a previous validator will show an error
- 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 determine_isic_status
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def determine_isic_status
return unless self.isic?
raise "Record is not new, won't change status" unless new_record?
raise "No member associated yet" unless member
self.isic_status = 'request'
- 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"