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?
- Read upRead up
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)
- Read upRead up
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?
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'
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)
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."
- Read upRead up
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"