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'
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
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 server_msg
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def server_msg(msg)
case msg.command
when /3\d\d/, 'JOIN', 'PART'
# transient messages
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 execute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def execute
backlog = Backlog.get_instance(bouncer)
device = backlog.get_device(conn)
if !args.empty?
- 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 parse_line
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.parse_line(line, ctx_name, options = {})
space = line.index(' ')
timestamp = Time.parse(line[0, space])
if options[:timestamp_only]
return timestamp, nil
- 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 get_stream
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_stream(ctx, for_reading = false)
mode = for_reading ? 'rb:utf-8' : 'ab:utf-8'
ctx = ctx.gsub(%r{[\./\\]}, '')
path = stream_path(ctx)
return nil if !path.file? && for_reading
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def client_msg(msg)
case msg.command
when 'PRIVMSG'
return if msg.ctcp? && !msg.action?
ctx = msg.args.first
- 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"