Showing 151 of 151 total issues
Class Conference
has 81 methods (exceeds 20 allowed). Consider refactoring. Open
class Conference < ApplicationRecord
include RevisionCount
require 'uri'
serialize :events_per_week, Hash
# Needed to call 'Conference.with_role' in /models/ability.rb
File conference.rb
has 651 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Conference < ApplicationRecord
include RevisionCount
require 'uri'
serialize :events_per_week, Hash
# Needed to call 'Conference.with_role' in /models/ability.rb
Method calendar
has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring. Open
def calendar
respond_to do |format|
format.ics do
calendar = Icalendar::Calendar.new
Conference.all.each do |conf|
- 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 icalendar_proposals
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def icalendar_proposals(calendar, proposals, conference)
proposals.each do |proposal|
calendar.event do |e|
e.dtstart = proposal.time
e.dtend = proposal.time + proposal.event_type.length * 60
- 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 Event
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class Event < ApplicationRecord
include ActionView::Helpers::NumberHelper # for number_with_precision
include ActiveRecord::Transitions
include RevisionCount
has_paper_trail on: [:create, :update], ignore: [:updated_at, :guid, :week], meta: { conference_id: :conference_id }
Class Program
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class Program < ApplicationRecord
has_paper_trail on: [:update], ignore: [:updated_at], meta: { conference_id: :conference_id }
belongs_to :conference
Class User
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class User < ApplicationRecord
# prevent N+1 queries with has_cached_role? by preloading roles *always*
default_scope { preload(:roles) }
has_many :ticket_purchases, dependent: :destroy
Method signed_in_with_organizer_role
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
def signed_in_with_organizer_role(user)
# ids of all the conferences for which the user has the 'organizer' role
conf_ids = Conference.with_role(:organizer, user).pluck(:id)
# ids of all the tracks that belong to the programs of the above conferences
track_ids = Track.joins(:program).where('programs.conference_id IN (?)', conf_ids).pluck(:id)
Method state_dropdown
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def state_dropdown(event, conference_id, email_settings)
selection = event.state.humanize
options = []
if event.transition_possible? :accept
options << [
Method toggle_user
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def toggle_user
user = User.find_by(email: user_params[:email])
state = user_params[:state]
url = if @track
- 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 show
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def show
event_schedules = @program.selected_event_schedules(
includes: [{ event: %i[event_type speakers submitter] }]
)
- 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 show
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def show
# load conference with header content
@conference = Conference.unscoped.eager_load(
:splashpage,
:program,
- 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 show
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show
# load conference with header content
@conference = Conference.unscoped.eager_load(
:splashpage,
:program,
Method overlapping
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def overlapping
return unless start_date && end_date && room && program.try(:tracks)
(program.tracks.accepted + program.tracks.confirmed - [self]).each do |existing_track|
next unless existing_track.room == room && existing_track.start_date && existing_track.end_date
- 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 signed_in
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def signed_in(user)
# Abilities from not_signed_in user are also inherited
not_signed_in
can :manage, User, id: user.id
Method index
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
# Redirect to new form if there is no conference
if Conference.count == 0
redirect_to new_admin_conference_path
return
Consider simplifying this complex logical expression. Open
if (request.path != '/accounts/sign_in' &&
request.path != '/accounts/sign_up' &&
request.path != '/accounts/password/new' &&
request.path != '/accounts/password/edit' &&
request.path != '/accounts/confirmation' &&
Method common_abilities_for_roles
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def common_abilities_for_roles(user)
can :manage, Registration, user_id: user.id
can :index, Conference
can :show, Registration, &:new_record?
Method get_values
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_values(conference, user, event = nil, booth = nil)
h = {
'email' => user.email,
'name' => user.name,
'conference' => conference.title,
Method purchase
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.purchase(conference, user, purchases)
errors = []
if count_purchased_registration_tickets(conference, purchases) > 1
errors.push('You cannot buy more than one registration tickets.')
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"