Method occurrences_in_month
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def occurrences_in_month(year, month)
monthly_pattern.map do |occurrence|
if occurrence.is_a?(Array)
ordinal, weekday = occurrence
wday = Date::DAYNAMES.index(weekday)
- 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 first_occurrence_on_or_after
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def first_occurrence_on_or_after(date)
@year, @month, seed_day = date.year, date.month, date.day
if skip > 1
offset = months_since_schedule_start(@year, @month)
remainder = offset % skip
- 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 first_occurrence_on_or_before
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def first_occurrence_on_or_before(date)
@year, @month, seed_day = date.year, date.month, date.day
if skip > 1
offset = months_since_schedule_start(@year, @month)
remainder = offset % skip
- 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 advance!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def advance!
@position += 1
next_month if @position >= cycle.length
day = cycle[@position]
- 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 rewind!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def rewind!
@position -= 1
prev_month if @position < 0
day = cycle[@position]
- 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 get_context
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_context
@last_day_of_month = [4, 6, 9, 11].member?(month) ? 30 : 31
@last_day_of_month = leap_year?(year) ? 29 : 28 if month == 2
@cycle = occurrences_in_month(year, month).sort
end
- 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"