Showing 182 of 294 total issues
Method update
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update
@sub_request = SubRequest.find(params[:id])
return unless user_is_owner_or_admin_of(@sub_request.shift, current_department)
begin
SubRequest.transaction do
- 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 detailed_stats
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def detailed_stats(start_date, end_date)
shifts_set = shifts.on_days(start_date, end_date).active
detailed_stats = {}
shifts_set.each do |s|
- 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 search
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def search
users = current_department.active_users
start_date = interpret_start
end_date = interpret_end
#filter results if we are searching
- 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 check_for_conflicts
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.check_for_conflicts(time_slots, wipe, time_slot_scope)
return "" if time_slots.empty?
table = TimeSlot.arel_table
time_slots_with_conflict = Array.new
time_slots.each_slice(450) do |tss|
- 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 narrow_down
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def narrow_down(payforms)
if ( !params[:unsubmitted] and !params[:submitted] and !params[:approved] and !params[:skipped] and !params[:printed] )
params[:unsubmitted] = params[:submitted] = params[:approved] = true
end
scope = []
- 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
Avoid too many return
statements within this method. Open
return ["user_profile_entries[#{id}]", :content, options.map{|opt| [opt, opt]}, {selected: content}]
Avoid too many return
statements within this method. Open
return false
Avoid too many return
statements within this method. Open
return false
Avoid too many return
statements within this method. Open
return options.map{|v| ["data_fields[#{id}]", 1, v]}
Avoid too many return
statements within this method. Open
return "Future"
Avoid too many return
statements within this method. Open
return false
Avoid too many return
statements within this method. Open
return "Completed"
Avoid too many return
statements within this method. Open
return options.map{|v| ["user_profile_entries[#{id}]", v]}
Avoid too many return
statements within this method. Open
return options.map{|v| ["user_profile_entries[#{id}]", v, chosen.include?(v) ? {checked: true} : {}]}
Avoid too many return
statements within this method. Open
return options.map{|v| ["user_profile_entries[#{id}]", :content, v, content==v ? {checked: true} : {}]}
Avoid too many return
statements within this method. Open
return false
Avoid too many return
statements within this method. Open
return false
Method no_concurrent_timeslots
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def no_concurrent_timeslots
dont_conflict_with_self = (self.new_record? ? "" : "AND id != #{self.id}")
if self.calendar.active
c = TimeSlot.where("start < ? AND end > ? AND location_id = ? AND active = ? #{dont_conflict_with_self}", self.end, self.start, self.location, true).count
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def create
parse_date_and_time_output(params[:sub_request])
join_date_and_time(params[:sub_request])
@sub_request = SubRequest.new(params[:sub_request])
@sub_request.shift = Shift.find(params[:shift_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 submit
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def submit
@payform = Payform.find(params[:id])
return unless user_is_owner_or_admin_of(@payform, @payform.department)
@payform.submitted = Time.now
- 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"