Showing 182 of 294 total issues
Method index_prep
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def index_prep
@period_start = params[:date] ? Date.parse(params[:date]).previous_sunday : Date.today.previous_sunday
# figure out what days to display based on user preferences
if params[:date].blank? and (current_user.user_config.view_week != "" and current_user.user_config.view_week != "whole_period")
# only if default view and non-standard setting
- 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 smtp
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def smtp
@@delivery_method = 'smtp'
@main_box = stack width: '100%' do
inscription link("Start Over", click: '/')
title "SMTP Settings", align: 'center'
- 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 14 (exceeds 5 allowed). Consider refactoring. Open
def create
errors = []
parse_date_and_time_output(params[:time_slot])
join_date_and_time(params[:time_slot])
@time_slot = TimeSlot.new(params[:time_slot])
- 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 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
@payform_item_set = PayformItemSet.find(params[:id])
set_payform_item_hours("payform_item_set")
date = build_date_from_params(:date, params[:payform_item_set])
@new_users = parse_users_autocomplete(params[:auto_ids])
Method update
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
#TODO: prevent params hacking w/ regard to setting roles and login and payrate
params[:user][:role_ids] ||= []
@user = User.find(params[:id])
#store role changes, or else they'll overwrite roles in other departments
Method update
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
@old_repeating_event = RepeatingEvent.find(params[:id])
parse_date_and_time_output(params[:repeating_event])
params[:repeating_event][:days] = params[:days]
if params[:repeating_event][:slot_or_shift] == "time_slot"
Method create
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
# raise params.to_yaml
parse_just_time(params[:requested_shift])
@requested_shift = RequestedShift.new(params[:requested_shift])
@requested_shift.preferred_start = nil unless params[:preferred_start_choice]
Method does_not_exceed_max_concurrent_shifts_in_location
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def does_not_exceed_max_concurrent_shifts_in_location
if self.scheduled?
max_concurrent = self.location.max_staff
shifts = Shift.active.scheduled.in_location(self.location).overlaps(self.start, self.end)
shifts.delete_if{|shift| shift.id = self.id} unless self.new_record?
- 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 generate_ical
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def generate_ical
cal = Icalendar::Calendar.new
cal.append_custom_property("METHOD","PUBLISH")
cal.append_custom_property("x-wr-calname", @type + "s: " + @source.name)
cal.append_custom_property("X-WR-CALDESC", @type + "s Calendar Feed for user: " + @user.name + ". The feed is " + @source.class.name.downcase + ": " + @source.name)
- 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 autocomplete
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def autocomplete
@list = []
classes = params[:classes] || ["User", "Department", "Role"]
if classes.include?("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 index
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def index
@period_start = params[:date] ? Date.parse(params[:date]).previous_sunday : Date.today.previous_sunday
@upcoming_shifts = Shift.where("user_id = ? and end > ? and department_id = ? and scheduled = ? and active = ?", current_user, Time.now.utc, current_department.id, true, true).order(:start).limit(5)
# for user view preferences partial
- 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_job_after
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_job_after
p = session[:external]
unless p.blank?
#if currently logged in user of RT and Payform are different
if current_user.login != p[:netid]
Method update
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
@user_profile = UserProfile.find(params[:id])
@user_profile.update_attributes(params[:user_profile]) #necessary for profile pics to save
@user = User.find(@user_profile.user_id)
Method create
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
#TODO: persistent calendar selection? it would be nice...
parse_date_and_time_output(params[:repeating_event])
session[:calendar] = params[:repeating_event][:calendar_id]
params[:repeating_event][:days] = params[:days]
Method calculate_default_times_shifts
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def calculate_default_times_shifts
if @shift.new_record? #true for new html&tooltip
@default_start_date = (params[:date] ? Time.parse(params[:date]) : Time.now).to_date
else # true for edit html&tooltip
@default_start_date = @shift.start
- 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 12 (exceeds 5 allowed). Consider refactoring. Open
def create
@data_entry = DataEntry.new({data_object_id: params[:data_object_id]})
#TODO: Fix this bug related to current_user.current_shift /.report
@current_shift = current_user.current_shift
@data_entry.write_content(params[:data_fields])
- 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 edit
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def edit
@dept_select = current_user.departments.map{|d| [d.name, d.id]}
@departments = current_user.departments
@data_objects = []
@data_types = []
Method save_import
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def save_import
if params[:commit]=="Cancel"
redirect_to import_department_users_path(@department) and return
end
@users=params[:users_to_import].collect{|i| params[:user][i]}
Method authentication
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def authentication
stack width: '100%' do
inscription link("Start Over", click: '/')
title "CAS Settings", align: 'center'
@main_stack = stack {
Method smtp
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def smtp
@@delivery_method = 'smtp'
@main_box = stack width: '100%' do
inscription link("Start Over", click: '/')
title "SMTP Settings", align: 'center'