aldesantis/artic

View on GitHub

Showing 4 of 6 total issues

Method <=> has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def <=>(other)
      # availabilities for weekdays come before availabilities for specific dates
      return -1 if date.nil? && !other.date.nil?
      return 1 if !date.nil? && other.date.nil?

Severity: Minor
Found in lib/artic/availability.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 normalize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def normalize(identifier)
        availabilities = by_identifier(identifier).sort

        normalized_availabilities = availabilities.inject([]) do |accumulator, availability|
          next (accumulator << availability) if accumulator.empty?
Severity: Minor
Found in lib/artic/collection/availability_collection.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 normalize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def normalize(date)
        occupations = by_date(date).sort

        normalized_occupations = occupations.inject([]) do |accumulator, occupation|
          next (accumulator << occupation) if accumulator.empty?
Severity: Minor
Found in lib/artic/collection/occupation_collection.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 bisect has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def bisect(other)
      return [other] unless overlaps?(other)
      return [] if covers?(other)

      if self.begin <= other.begin && self.end <= other.end
Severity: Minor
Found in lib/artic/time_range.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