Showing 19 of 46 total issues
Class Proposal
has 40 methods (exceeds 20 allowed). Consider refactoring. Open
class Proposal < ApplicationRecord
include Proposal::State
has_many :public_comments, dependent: :destroy
has_many :internal_comments, dependent: :destroy
Class ProposalDecorator
has 36 methods (exceeds 20 allowed). Consider refactoring. Open
class ProposalDecorator < ApplicationDecorator
include Proposal::State
decorates :proposal
delegate_all
decorates_association :speakers
Class Event
has 36 methods (exceeds 20 allowed). Consider refactoring. Open
class Event < ApplicationRecord
has_many :teammates, dependent: :destroy
has_many :staff, through: :teammates, source: :user
has_many :proposals, dependent: :destroy
has_many :speakers
Function exports
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(api) {
var validEnv = ['development', 'test', 'production']
var currentEnv = api.env()
var isDevelopmentEnv = api.env('development')
var isProductionEnv = api.env('production')
Class ApplicationController
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class ApplicationController < ActionController::Base
include Pundit
include ActivateNavigation
rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
# after_action :verify_authorized, except: :index
Class EventStats
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class EventStats
attr_reader :event
def initialize(event)
@event = event
Class ProgramSession
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class ProgramSession < ApplicationRecord
LIVE = 'live'.freeze # confirmed accepted
DRAFT = 'draft'.freeze # created by organizer, not ready to be published (live)
UNCONFIRMED_ACCEPTED = 'unconfirmed accepted'.freeze # accepted, to be confirmed by speaker
UNCONFIRMED_WAITLISTED = 'unconfirmed waitlisted'.freeze
Class EventsController
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Staff::EventsController < Staff::ApplicationController
before_action :enable_staff_event_subnav
helper_method :sticky_template_test_email
Class TimeSlotDecorator
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Staff::TimeSlotDecorator < Draper::Decorator
decorates :time_slot
delegate_all
def start_time
Method create_from_proposal
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.create_from_proposal(proposal)
transaction do
ps = ProgramSession.create!(event_id: proposal.event_id,
proposal_id: proposal.id,
title: proposal.title,
- 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 incomplete_checklist_items
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def incomplete_checklist_items
missing_items = []
missing_items << "Event must have a url" if url.blank?
missing_items << "Event must have a start date" unless start_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 after_sign_in_path_for
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def after_sign_in_path_for(user)
if session[:pending_invite_accept_url]
session[:pending_invite_accept_url]
elsif !user.complete?
edit_profile_path
- 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 finalize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def finalize
transaction do
update_state(SOFT_TO_FINAL[state]) if SOFT_TO_FINAL.key?(state)
if becomes_program_session?
ps = ProgramSession.create_from_proposal(self)
- 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 from_omniauth
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.from_omniauth(auth, invitation_email = nil)
where(provider: auth.provider, uid: auth.uid).first_or_create do |user|
password = Devise.friendly_token[0, 20]
user.name = auth['info']['name'] if user.name.blank?
user.email = invitation_email || auth['info']['email'] || '' if user.email.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 state_buttons
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def state_buttons(states: nil, show_finalize: true, show_hard_reset: false, small: false)
btns = buttons.map { |text, state, btn_type, hidden|
next unless states.nil? || states.include?(state)
state_button(text, update_state_path(state),
hidden: hidden,
- 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 set_proposal_counts
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_proposal_counts
@all_accepted_count ||= current_event.stats.all_accepted_proposals
@all_waitlisted_count ||= current_event.stats.all_waitlisted_proposals
unless sticky_selected_track == 'all'
@all_accepted_track_count ||= current_event.stats.all_accepted_proposals(sticky_selected_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 create_time_slots
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_time_slots
slots = build_time_slots
TimeSlot.transaction do
slots.each do |s|
errors.push(*s.errors) unless s.save
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def update
if current_user.update(user_params)
if current_user.unconfirmed_email.present?
flash[:danger] = I18n.t("devise.registrations.update_needs_confirmation")
- 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 proposal_date_range
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def proposal_date_range
now = DateTime.now
if object.proposals.present? && object.closes_at
event_first_proposal_created_at =
object.proposals.order(created_at: :asc).pluck(:created_at).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"