app/models/time_booking.rb
Class TimeBooking
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class TimeBooking < ActiveRecord::Base
include Redmine::I18n
attr_accessible :started_on, :stopped_at, :time_entry_id, :time_log_id, :project, :project_id, :comments, :issue, :activity_id
belongs_to :project
Method project=
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def project=(project)
return if project == self.project # no validation or permission checks necessary if there are no changes!
raise StandardError, l(:tt_error_not_allowed_to_book_without_project) if project.nil?
# workaround to get dirty-flag working even for associated fields!
- 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 issue=
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def issue=(issue)
return if issue == self.issue # no validation or permission checks necessary if there are no changes!
# check if project has to be updated also!
unless issue.nil?
- 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"