Showing 6 of 12 total issues

Method recursing_dive has a Cognitive Complexity of 7 (exceeds 3 allowed). Consider refactoring.
Open

    private def recursing_dive(target_hash, &fn)
      target_hash.each { |k, v|
        yield(target_hash, k, v) if match?(target_hash, k, v, @trace_path)

        next unless target_hash[k].is_a?(Hash)
Severity: Minor
Found in lib/xf/trace.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 clamp has a Cognitive Complexity of 6 (exceeds 3 allowed). Consider refactoring.
Open

    def clamp(start_range, end_range)
      Proc.new { |target|
        next start_range if target < start_range
        next end_range   if target > end_range

Severity: Minor
Found in lib/xf/public_api.rb - About 45 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 match? has 4 arguments (exceeds 3 allowed). Consider refactoring.
Open

    private def match?(hash, key, value, matcher)
Severity: Minor
Found in lib/xf/trace_value.rb - About 35 mins to fix

    Method match? has 4 arguments (exceeds 3 allowed). Consider refactoring.
    Open

        private def match?(hash, key, value, matcher)
    Severity: Minor
    Found in lib/xf/trace_key_value.rb - About 35 mins to fix

      Method match? has 4 arguments (exceeds 3 allowed). Consider refactoring.
      Open

          private def match?(hash, key, value, matcher)
      Severity: Minor
      Found in lib/xf/trace.rb - About 35 mins to fix

        Method get_value has a Cognitive Complexity of 4 (exceeds 3 allowed). Consider refactoring.
        Open

            def get_value(hash, &fn)
              value = if hash.respond_to?(:dig)
                hash.dig(*@paths)
              else
                new_hash = hash
        Severity: Minor
        Found in lib/xf/scope.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