rossta/montrose

View on GitHub

Showing 5 of 6 total issues

Class Options has 51 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Options
    include Montrose::Utils

    @default_starts = nil
    @default_until = nil
Severity: Major
Found in lib/montrose/options.rb - About 7 hrs to fix

    File options.rb has 299 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Montrose
      class Options
        include Montrose::Utils
    
        @default_starts = nil
    Severity: Minor
    Found in lib/montrose/options.rb - About 3 hrs to fix

      Method include? has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def include?(timestamp)
            return false if earlier?(timestamp) || later?(timestamp)
      
            recurrence = finite? ? self : starts(timestamp)
      
      
      Severity: Minor
      Found in lib/montrose/recurrence.rb - About 55 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 advance has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def advance(time)
            yes, no = @stack.partition { |rule| rule.include?(time) }
      
            if no.empty?
              yes.all? { |rule| rule.advance!(time) } or return false
      Severity: Minor
      Found in lib/montrose/stack.rb - About 35 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 as_time has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def as_time(time)
            return nil unless time
      
            if time.is_a?(String)
              parse_time(time)
      Severity: Minor
      Found in lib/montrose/utils.rb - About 35 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