lib/volt/router/routes.rb

Summary

Maintainability
C
1 day
Test Coverage

Method match_path has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    def match_path(original_parts, remaining_parts, node)
      # Take off the top part and get the rest into a new array
      # part will be nil if we are out of parts (fancy how that works out, now
      # stand in wonder about how much someone thought this through, though
      # really I just got lucky)
Severity: Minor
Found in lib/volt/router/routes.rb - About 3 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

Class Routes has 27 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Routes
    def initialize
      # Paths where there are no bindings (an optimization)
      @direct_routes   = {}

Severity: Minor
Found in lib/volt/router/routes.rb - About 3 hrs to fix

    Method check_params_match has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def check_params_match(test_params, param_matcher)
          param_matcher.each_pair do |key, value|
            if value.is_a?(Hash)
              if test_params[key]
                result = check_params_match(test_params[key], value)
    Severity: Minor
    Found in lib/volt/router/routes.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 add_indirect_path has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def add_indirect_path(node, path, params)
          parts = url_parts(path)
    
          parts.each_with_index do |part, index|
            if has_binding?(part)
    Severity: Minor
    Found in lib/volt/router/routes.rb - About 1 hr 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

    There are no issues that match your filters.

    Category
    Status