codekitchen/tkellem

View on GitHub
lib/tkellem/bouncer_connection.rb

Summary

Maintainability
D
2 days
Test Coverage

Method receive_line has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

  def receive_line(line)
    failsafe("message: {#{line}}") do
      line.force_encoding Encoding::UTF_8
      trace "from client: #{line}"
      return if line.blank?
Severity: Minor
Found in lib/tkellem/bouncer_connection.rb - About 6 hrs 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 maybe_connect has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

  def maybe_connect
    return unless @connecting_nick && @username && !@user
    if @password
      @name = @username
      @user = User.authenticate(@username, @password)
Severity: Minor
Found in lib/tkellem/bouncer_connection.rb - About 3 hrs 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 receive_line has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def receive_line(line)
    failsafe("message: {#{line}}") do
      line.force_encoding Encoding::UTF_8
      trace "from client: #{line}"
      return if line.blank?
Severity: Major
Found in lib/tkellem/bouncer_connection.rb - About 2 hrs to fix

    File bouncer_connection.rb has 260 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'active_support/core_ext/object/blank'
    
    require 'eventmachine'
    require 'tkellem/irc_message'
    
    
    Severity: Minor
    Found in lib/tkellem/bouncer_connection.rb - About 2 hrs to fix

      Method maybe_connect has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def maybe_connect
          return unless @connecting_nick && @username && !@user
          if @password
            @name = @username
            @user = User.authenticate(@username, @password)
      Severity: Minor
      Found in lib/tkellem/bouncer_connection.rb - About 1 hr to fix

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

          def msg_tkellem(msg)
            case @state
            when :recaptcha
              if @recaptcha.valid_response?(msg.args.last)
                say_as_tkellem "Looks like you're human. Whew, I hate robots."
        Severity: Minor
        Found in lib/tkellem/bouncer_connection.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

        There are no issues that match your filters.

        Category
        Status