Showing 182 of 294 total issues
File shift.rb
has 453 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Shift < ActiveRecord::Base
include ActionView::Helpers::DateHelper
delegate :loc_group, to: 'location'
belongs_to :calendar
Class Shift
has 47 methods (exceeds 20 allowed). Consider refactoring. Open
class Shift < ActiveRecord::Base
include ActionView::Helpers::DateHelper
delegate :loc_group, to: 'location'
belongs_to :calendar
Method calendar_day_preprocessing
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
def calendar_day_preprocessing(day)
@location_rows = {}
@location_rows_timeslots = {}
- 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
Class User
has 41 methods (exceeds 20 allowed). Consider refactoring. Open
class User < ActiveRecord::Base
acts_as_authentic do |options|
options.maintain_sessions false
end
Method day_preprocessing
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def day_preprocessing(day)
@location_rows = {}
#for AJAX; needs cleanup if we have time
@loc_groups = current_user.user_config.view_loc_groups.select{|l| !l.locations.empty?}
- 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 location_preprocessing
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def location_preprocessing(location, day)
timeslots = @location_rows_timeslots[location]
shifts = @location_rows[location].flatten
#what times is this location open?
- 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 calendar_day_preprocessing
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def calendar_day_preprocessing(day)
@location_rows = {}
@location_rows_timeslots = {}
#different calendars are different colors
- 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 save_import
has a Cognitive Complexity of 31 (exceeds 5 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]}
- 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 application_controller.rb
has 354 lines of code (exceeds 250 allowed). Consider refactoring. Open
class ApplicationController < ActionController::Base
# almost everything we do is restricted to a department so we always load_department
# feel free to skip_before_filter when desired
before_filter :load_app_config
before_filter :department_chooser
Method update
has a Cognitive Complexity of 30 (exceeds 5 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)
- 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 29 (exceeds 5 allowed). Consider refactoring. Open
def update
@punch_clock_set = PunchClockSet.find(params[:id])
messages = []
@punch_clock_set.punch_clocks.each do |pc|
if params[:pause]
- 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
Class ApplicationController
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
class ApplicationController < ActionController::Base
# almost everything we do is restricted to a department so we always load_department
# feel free to skip_before_filter when desired
before_filter :load_app_config
before_filter :department_chooser
Method add_job_after
has a Cognitive Complexity of 26 (exceeds 5 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]
- 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 25 (exceeds 5 allowed). Consider refactoring. Open
def create
if @user = User.where(login: params[:user][:login]).first
if @user.departments.include? @department #if user is already in this department
flash[:notice] = "This user already exists in this department."
else
- 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 23 (exceeds 5 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
- 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 user.rb
has 302 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'net/ldap'
require 'rails_extensions'
require 'memoist'
class User < ActiveRecord::Base
Method calendar_day_preprocessing
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
def calendar_day_preprocessing(day)
@location_rows = {}
@location_rows_timeslots = {}
Method day_preprocessing
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
def day_preprocessing(day)
@location_rows = {}
#for AJAX; needs cleanup if we have time
@loc_groups = current_user.user_config.view_loc_groups.select{|l| !l.locations.empty?}
Method update
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def update
if params[:loc]
params[:user_config][:view_loc_groups] = params[:loc].keys.join(", ")
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 parse_date_and_time_output
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def parse_date_and_time_output(form_output)
time_attribute_names = ["start", "end", "mandatory_start", "mandatory_end"]
time_attribute_names.each do |field_name|
unless form_output["#{field_name}_time(5i)"].blank? || form_output["#{field_name}_time(4i)"].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"