lib/schedule_attributes/input.rb
Class Input
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Input
module RepeatingDates
def repeat?; true end
Method end_time_date
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def end_time_date
return date_input unless @params[:start_time].present?
return nil if @params[:all_day]
return nil unless @params[:end_time].present?
parse_date_time(date_input, @params[:end_time]) <= start_time ? (Time.parse(date_input) + 1.day).strftime('%Y-%m-%d') : date_input
- 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 end_date
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def end_date
if @params[:end_date]
parse_date_time(@params[:end_date], @params[:end_time] || @params[:start_time])
elsif @params[:end_time] && !time_only?(@params[:end_time])
parse_date_time(@params[:end_time])
- 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"