fnordfish/matchd

View on GitHub

Showing 4 of 6 total issues

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

      def parse(args)
        val =
          case args
          when Array
            if triplet = parse_array(args)
Severity: Minor
Found in lib/matchd/glue/async_endpoint.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 Response has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def Response(respond, fallback_resource_class) # rubocop:disable Naming/MethodName
        respond = [respond] unless respond.is_a?(Array) # don't convert Hash to Array
        respond.flat_map do |r|
          resource_class =
            if r.is_a?(Hash)
Severity: Minor
Found in lib/matchd/response.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 Rule has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def Rule(data) # rubocop:disable Naming/MethodName
        return Rule::Invalid.new(data) unless data.is_a?(Hash)

        if data["respond"]
          Rule::Respond.new(data)
Severity: Minor
Found in lib/matchd/rule.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 visit! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def visit!(server, _name, _resource_class, transaction)
    transaction.passthrough!(passthrough_resolver, passthrough_options) do |response|
      server.logger.debug ";; Passthrough to upstream resolver"
      server.logger.debug ";; Question"
      server.logger.debug(*response.question.map { |q, r| "#{q}\t#{r}" })
Severity: Minor
Found in lib/matchd/rule/passthrough.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