wjessop/fuzzy_version_matcher

View on GitHub

Showing 2 of 2 total issues

Method search has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def search(version_string, version_segments = nil)
            # If version_segments is nil we are the top node, create a version_segments array
            version_segments ||= string_to_segments(version_string)

            next_segment = version_segments.shift
Severity: Minor
Found in lib/fuzzy_version_matcher.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 add_node has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def add_node(version_string, version_segments = nil)
            # If version_segments is nil we are the top node, create a version_segments array
            version_segments ||= string_to_segments(version_string)

            next_segment = version_segments.shift
Severity: Minor
Found in lib/fuzzy_version_matcher.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