Showing 20 of 62 total issues
Class ApplicationData
has 60 methods (exceeds 20 allowed). Consider refactoring. Open
class ApplicationData
def initialize(data)
@data = data || {}
end
Class User
has 35 methods (exceeds 20 allowed). Consider refactoring. Open
class User < ApplicationRecord
include EmailPreferences
TSHIRT_SIZES = %w(XXS XS S M L XL 2XL 3XL)
TSHIRT_CUTS = %w(Straight Fitted)
Class Team
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Team < ApplicationRecord
include HasSeason
include ProfilesHelper
KINDS = %w(full_time part_time)
Class Application
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class Application
include ActiveModel::Model
attr_accessor :id,
:team_name,
Method initialize
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def initialize(user)
user ||= User.new
alias_action :create, :read, :update, :destroy, to: :crud
- 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 initialize
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(user)
user ||= User.new
alias_action :create, :read, :update, :destroy, to: :crud
Method update
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def update
source.update_attributes!(title: discover_title) unless source.title.present?
source.feed_url = discover_feed_url unless source.feed_url.present?
update_entries
source.save! if source.feed_url_changed? && source.feed_url != source.url
- 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_entries
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def update_entries
parse.entries.each do |data|
item = Item.new(source.url, source.team_id, data)
raise "can not find guid for item in source #{source.feed_url}" unless item.guid
# logger.info "processing item #{item.guid}: #{item.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
Function addFields
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
addFields: function(e) {
// Setup
var link = e.currentTarget;
var assoc = $(link).data('association'); // Name of child
var blueprint = $('#' + $(link).data('blueprint-id'));
Method update
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def update
respond_to do |format|
if @user.update_attributes(user_params)
notice = nil
# We disabled the confirmation instruction sending in the omniauth
- 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_application_dates
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set_application_dates
return if year.blank?
self.starts_at ||= Time.utc(year, *SUMMER_OPEN) # 1 jul
self.ends_at ||= Time.utc(year, *SUMMER_CLOSE) # 30 sept
self.applications_open_at ||= Time.utc(year, *APPL_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 index
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def index
@display_roles = (Role::TEAM_ROLES + ['supervisor']).map(&:pluralize)
if params[:sort]
direction = params[:direction] == 'asc' ? 'ASC' : 'DESC'
- 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 confirm
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def confirm
@role = Role.where.not(confirmation_token: nil).find_by! confirmation_token: params[:id]
@team = @role.team
respond_to do |format|
if @role.pending?
- 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 new
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def new
if !current_user.confirmed?
redirect_to root_path, alert: 'You need to click on the link in the email to confirm your account before you can create an application.'
elsif current_user.student?
redirect_to root_path, alert: 'You need to have a partner in your team to create an application.' unless current_team.try(:confirmed?)
- 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 teams
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def teams
return @teams if @teams
@teams = Team
@teams = @teams.where(kind: group.to_sym == :selected_teams ? Team::KINDS : nil) if group.to_sym != :everyone
@teams = @teams.where(season: Season.where(name: seasons)) if seasons.any?
- 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 activity_score
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def activity_score
unless buffer_days?
if @team.activities.empty?
@score += 3
elsif @team.last_activity.created_at <= Time.now - 5.days
- 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 apply
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def apply
if current_team.coaches_confirmed?
if application_draft.ready? && application_draft.submit_application!
flash[:notice] = 'Your application has been submitted!'
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 edit
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def edit
@team.sources.build(kind: 'blog') unless @team.sources.any?
@conferences = conference_list
@team.conference_attendances.build unless @team.conference_attendances.present?
@team.build_conference_preference unless @team.conference_preference.present?
- 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 comments_score
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def comments_score
latest_comment = @team.comments.ordered.first
unless buffer_days?
if @team.comments.empty?
@score += 3
- 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 status_for
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def status_for(team, member, role_name)
if role_name == :coach
role = team.roles.find { |role| role.user == member }
if role&.confirmed?
content_tag :span, 'Confirmed', class: 'label label-default'
- 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"