adhearsion/adhearsion

View on GitHub
lib/adhearsion/rayo/connection/xmpp.rb

Summary

Maintainability
A
1 hr
Test Coverage

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

        def ping_rayo
          client.write_with_handler Blather::Stanza::Iq::Ping.new(:get, root_domain) do |response|
            begin
              handle_error response if response.is_a? Blather::BlatherError
            rescue ProtocolError => e
Severity: Minor
Found in lib/adhearsion/rayo/connection/xmpp.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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def initialize(options = {})
          raise ArgumentError unless (@username = options[:username]) && options[:password]

          setup(*[:username, :password, :host, :port, :certs, :connection_timeout].map { |key| options.delete key })

Severity: Minor
Found in lib/adhearsion/rayo/connection/xmpp.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 prep_command_for_execution has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def prep_command_for_execution(command, options = {})
          command.connection    = self
          command.target_call_id    ||= options[:call_id]
          command.target_mixer_name ||= options[:mixer_name]
          command.domain            ||= options[:domain]
Severity: Minor
Found in lib/adhearsion/rayo/connection/xmpp.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

There are no issues that match your filters.

Category
Status