Method to_s_raw
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def to_s_raw
# Assume one date only, equal start/end
start_format_list = [nil, :wday, :month, :day, :year, :at, :hour, :min, :suffix, nil]
start_details = time_details(@start_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"
Further reading
Method to_s_raw
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_s_raw
# Assume one date only, equal start/end
start_format_list = [nil, :wday, :month, :day, :year, :at, :hour, :min, :suffix, nil]
start_details = time_details(@start_time)
Method time_details
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def time_details(t)
# Get the parts for formatting this time, as a hash of
# strings: keys (roughly) match the equivalent methods on DateTime, but only
# relevant keys will be filled in. If relative is true (the default):
# - if it's today, tomorrow, or yesterday, :wday will be eg "today"
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize(start_time, end_time=nil, opts=nil)
# Initialize with a single DateTime, a pair of DateTimes,
# or an object that responds_to start_time and end_time, and
# several options
#
- 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"