Class TaskRecord
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class TaskRecord < AbstractTask
has_many :property_values, :through => :task_property_values
scope :from_this_year, lambda { where('created_at > ?', Time.zone.now.beginning_of_year - 1.month) }
scope :open_only, -> { where(:status => 0) }
Method update_group
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def update_group(user, group, value, icon = nil)
if group == 'milestone'
val_arr = value.split('/')
task_project = user.projects.find_by(:name => val_arr[0])
if user.can?(task_project, 'milestone')
- 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_group
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_group(user, group, value, icon = nil)
if group == 'milestone'
val_arr = value.split('/')
task_project = user.projects.find_by(:name => val_arr[0])
if user.can?(task_project, 'milestone')
Method users_to_notify
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def users_to_notify(user_who_made_change=nil)
if user_who_made_change and !user_who_made_change.receive_own_notifications?
recipients= self.users.active.where('users.id != ? and users.receive_notifications = ?', user_who_made_change.id || 0, true)
else
recipients= self.users.active.where(:receive_notifications => true)
- 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 score_rules
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def score_rules
score_rules = []
# Query scores only if company is using score rules
if company.use_score_rules?
- 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"