moleculer-ruby/moleculer

View on GitHub

Showing 5 of 76 total issues

Class Broker has 39 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Broker
    include Moleculer::Support
    extend Forwardable
    attr_reader :config, :logger

Severity: Minor
Found in lib/moleculer/broker.rb - About 5 hrs to fix

Method process_message has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

          def process_message(message)
            return :disconnect if message == @disconnect_hash

            return nil if message_is_disconnect?(message)

Severity: Minor
Found in lib/moleculer/transporters/redis.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 connect has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Confirmed

          def connect
            @thread = Thread.new do
              begin
                @logger.debug "starting subscription to '#{@channel}'"
                @connection.subscribe(@channel) do |on|
Severity: Minor
Found in lib/moleculer/transporters/redis.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 register_node has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def register_node(node)
      return local_node if @local_node && node.id == @local_node.id

      if node.local?
        raise Errors::LocalNodeAlreadyRegistered, "A LOCAL node has already been registered" if @local_node
Severity: Minor
Found in lib/moleculer/registry.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 parse_args has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def parse_args(args)
        if args.last.is_a?(Hash)
          args.each_index do |v|
            args[v] = "\n" + args[v].ai + "\n" unless args[v].is_a?(String)
          end
Severity: Minor
Found in lib/moleculer/support/log_proxy.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