Showing 16 of 144 total issues
Method reset_pk_sequence!
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def reset_pk_sequence!(table, pk = nil, sequence = nil) #:nodoc:
unless pk and sequence
default_pk, default_sequence = pk_and_sequence_for(table)
pk ||= default_pk
- 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 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Event < ActiveRecord::Base
include TwitterHashTagFixer
validates_presence_of :name
validates_presence_of :category
Class User
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable, :lockable and :timeoutable
devise :database_authenticatable, :registerable, :omniauthable,
:recoverable, :rememberable, :trackable, :validatable
Method update_with_password_pass
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def update_with_password_pass(params={})
if params[:password].blank? and params[:email] == self.email
params.delete(:current_password)
params.delete(:password)
- 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 <=>
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def <=>(other)
if (self.occurrence.year != other.occurrence.year) || (self.occurrence.month != other.occurrence.month) || (self.occurrence.day != other.occurrence.day)
# not on same day
return self.occurrence <=> other.occurrence
elsif self.full_day
- 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 a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def initialize(user)
if user.present? && user.admin?
can :manage, :all
elsif user.present?
# Achtung! Keine Blocks benutzen, sondern immer die
- 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 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(user)
if user.present? && user.admin?
can :manage, :all
elsif user.present?
# Achtung! Keine Blocks benutzen, sondern immer die
Method all
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def all
# If there is no token, but we are currently logged in
if current_user
@auth = Authorization.create_authorization(request.env["omniauth.auth"], current_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 is_for_user?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def is_for_user?(user)
return true unless user
# Let us be a little more verbose than the old code
# !((self.event.tag_list & user.hate_list).length > 0 && self.users.exclude?(user))
hated_tags_event = (self.event.tag_list & user.hate_list)
- 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 fix_twitter
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def fix_twitter
if twitter
if twitter[0] == '@'
self.twitter = twitter[1..-1]
elsif m = twitter.match(/http(?:s)?:\/\/twitter.com\/(.*)/)
- 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
Avoid too many return
statements within this method. Open
return time_comparison
Avoid too many return
statements within this method. Open
return self.full_name.downcase <=> other.full_name.downcase
Method css_class
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def css_class
[
(active ? "active" : false),
(has_events ? "has_events" : false),
(date == Date.today ? "today" : false)
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def create
params[:event][:schedule_rules] = JSON.parse(params[:event][:schedule_rules]) if params[:event][:schedule_rules]
params[:event][:excluded_times] = JSON.parse(params[:event][:excluded_times]) if params[:event][:excluded_times]
reconstruct_start_time
create! do |success|
- 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
params[:event][:schedule_rules] = JSON.parse(params[:event][:schedule_rules]) if params[:event][:schedule_rules]
params[:event][:excluded_times] = JSON.parse(params[:event][:excluded_times]) if params[:event][:excluded_times]
reconstruct_start_time
update! do |success|
- 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_missing_to_list
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_missing_to_list(handles, list)
handles_in_list = members(list).map(&:screen_name)
(handles - handles_in_list).each do |screen_name|
begin
request_wrapper do
- 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"