boblail/hiccup

View on GitHub

Showing 24 of 24 total issues

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]
Severity: Minor
Found in lib/hiccup/enumerable/monthly_enumerator.rb - About 25 mins to fix

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]
Severity: Minor
Found in lib/hiccup/enumerable/monthly_enumerator.rb - About 25 mins to fix

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
Severity: Minor
Found in lib/hiccup/enumerable/monthly_enumerator.rb - About 25 mins to fix

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 6 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(options={})
      @kind             =(options[:kind] || :never).to_sym
      @start_date       =(options[:start_date] || Date.today).to_date
      @ends             = options.key?(:ends) ? options[:ends] : false
      @end_date         = options[:end_date] ? options[:end_date].to_date : nil
Severity: Minor
Found in lib/hiccup/schedule.rb - About 25 mins to fix

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

Severity
Category
Status
Source
Language