Showing 36 of 36 total issues
Method execute
has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring. Open
def execute
# TODO: this got gross
if args.empty? && !opts['remove']
list
return
- 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 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
File tkellem_bot.rb
has 393 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'shellwords'
require 'yaml'
module Tkellem
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 server_msg
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def server_msg(msg)
return if plugins.any? do |plugin|
!plugin.server_msg(self, msg)
end
- 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 backlog.rb
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'backwards_file_reader'
require 'fileutils'
require 'geoip'
require 'pathname'
require 'time'
Method server_msg
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
def server_msg(msg)
return if plugins.any? do |plugin|
!plugin.server_msg(self, msg)
end
Class Backlog
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Backlog
include Tkellem::EasyLogger
Bouncer.add_plugin(self)
SERVER_TIME_CAPS = %w{server-time znc.in/server-time-iso}.freeze
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 execute
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute
# TODO: this got gross
if args.empty? && !opts['remove']
list
return
Method send_backlog
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def send_backlog(conn, ctx_name, stream, time_zone)
while line = stream.gets
timestamp, msg = self.class.parse_line(line, ctx_name)
next unless msg
msg.readdress_to(@bouncer.nick)
- 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 client_msg
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def client_msg(client, msg)
return if plugins.any? do |plugin|
!plugin.client_msg(self, client, msg)
end
- 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 replay
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def replay
line = []
if !tags.empty?
line << "@#{tags.map { |k, v| v.nil? ? k : "#{k}=#{v}"}.join(';') }"
- 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 run
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
op = OptionParser.new do |opts|
opts.banner = "Usage #{$0} <command> <options>"
opts.separator %{\nWhere <command> is one of:
start start the jobs daemon
Method execute
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def execute
if opts['network'].present? # only settable by admins
target = Network.where(["LOWER(name) = LOWER(?) AND user_id IS NULL", opts['network']]).first
else
target = bouncer.try(:network_user)
- 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 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 client_msg
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def client_msg(client, msg)
return if plugins.any? do |plugin|
!plugin.client_msg(self, client, msg)
end
Method execute
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def execute
case args.size
when 0
r "Settings:"
Setting.all.each { |s| r " #{s}" }
- 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 modify
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def modify
instance = model.where(find_attributes).first
new_record = false
if instance
instance.attributes = attributes
- 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"