dtaniwaki/url_regexp

View on GitHub

Showing 3 of 3 total issues

Method to_regexp_s has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def to_regexp_s
      if @wildcard_threshold < size
        '([^#?]*)'
      elsif 1 < size
        children_paths = map(&:paths).reduce { |a, e| a & e }
Severity: Minor
Found in lib/url_regexp/path_set.rb - About 2 hrs 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 to_regexp_s has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def to_regexp_s
      common_queries = @queries.reduce { |a, e| a & e } || []
      common_queries = common_queries.map { |q| Regexp.quote(q) }
      if 1 <= common_queries.size
        if 1 == common_queries.size
Severity: Minor
Found in lib/url_regexp/query.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 append has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def append(path)
      if path == ''
        @paths.append(Path.new('', self, @options))
      elsif @parent.nil?
        _, label, rest = path.split('/', 3)
Severity: Minor
Found in lib/url_regexp/path.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