Showing 6 of 8 total issues
Method memoize
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def memoize(method)
unmemoized_method = :"_unmemoized_#{method}"
alias_method unmemoized_method, method
define_method method do |*args, **kargs, &block|
if Rodbot::Memoize.suspend? || block
- 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 new
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.new(string, room: nil)
allocate.instance_eval do
serializer = Rodbot::Serializer.new(string)
if serializer.deserializable?
hash = serializer.hash
- 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 rescued_call
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def rescued_call(service: nil, extension: nil, daemonize: false, debugger: false, **)
require 'debug' if debugger
daemonize = true unless service
Rodbot::Services.new.then do |services|
(service ? [service] : Rodbot::SERVICES).each do |service|
- 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 require_extensions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def require_extensions(service)
Rodbot.config(:plugin).each_key do |name|
path = "rodbot/plugins/#{name}/#{service}"
if rescued_require(path)
Rodbot.log("#{path} required", level: Logger::DEBUG)
- 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 cleanup
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def cleanup
Rodbot.env.tmp.glob("#{group}.*.pid").each do |pid_file|
pid = pid_file.read.to_i
Process.kill('INT', pid) unless pid == Process.pid
rescue Errno::ESRCH
- 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 each_template_path
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def each_template_path
@templates_path.glob(GLOB).each do |template_path|
next unless template_path.file?
target_path = template_path.relative_path_from(@templates_path)
content = if template_path.extname == '.gerb'
- 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"