kkdoo/rodent

View on GitHub

Showing 3 of 3 total issues

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

      def hook_into_callback_chain(env, *args)
        async_callback = env['async.callback']

        downstream_callback = proc do |status, headers, response|
          result_response = [status, headers, response]
Severity: Minor
Found in lib/rodent/goliath/middleware.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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def initialize(address, port, config, status, logger)
Severity: Minor
Found in lib/rodent/goliath/plugin.rb - About 35 mins to fix

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

        def bind(error_handler)
          AMQP::Channel.new do |channel|
            channel.prefetch(100)
            queue = channel.queue(@type, exclusive: true, auto_delete: true)
            queue.bind(channel.direct('rodent.requests'), routing_key: @type)
    Severity: Minor
    Found in lib/rodent/listener.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