Showing 22 of 22 total issues
Method toggle_methods
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.toggle_methods(globlev, logger)
for lev in globlev...LEVELS # satisfies >= globlev
next if lev < logger.level # satisfies >= level
next if LNAMES[lev] == 'OFF'
next if LNAMES[lev] == 'ALL'
- 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 build
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def build(logger_name, timestamp, level, message, exception, file, line, method)
Method reassign_any_children
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def reassign_any_children(parent)
synchronize do
for _, logger in instance.loggers
next if logger.is_root?
logger.parent = parent if logger.path =~ /^#{parent.fullname}$/
- 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 set_from_hash
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set_from_hash(hash)
ParameterParsers.each { |s, options|
v = nil
if hash.has_key?(s) || hash.has_key?(s.to_s)
v = (hash[s] or hash[s.to_i]).to_i
- 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 validate_file
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate_file
if @filename.class != String
raise TypeError, "Argument 'filename' must be a String"
end
if FileTest.exist?( @filename )
- 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 initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(_fullname, _uri, _level=nil,
_additive=true, _trace=false, &accept)
Method write
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def write(data)
return if !@expecting
data = data[0..-2]
m = @expecting.instance_of?(Array) ? @expecting.shift : @expecting
if m.instance_of? String
- 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_global_level
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse_global_level
return unless @config.has_key?('pre_config')
global_level = nil
['global', 'root'].each do |node|
if @config['pre_config'].has_key?(node)
- 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 validate_smtp_params
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate_smtp_params(hash)
ParameterParsers.each { |k, v|
v ||= {}
value = hash[k] || hash[k.to_s]
value ||= v[:default]
- 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 find_ancestor
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def find_ancestor(path)
arr = path.split Log4rConfig::LoggerPathDelimiter
logger = nil
synchronize do
while arr.size > 0 do
- 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 key_to_sym
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def key_to_sym(hash)
keys = []
hash.each do |k, v|
unless k.instance_of?(Symbol)
keys << k
- 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 requires_roll?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def requires_roll?
return false if @rolling
@rolling = size_exceeded? || time_exceeded?
if @rolling
Logger.log_internal {
- 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 config_outputter_only_at
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def config_outputter_only_at
if @config.has_key? :only_at
only_at = @config[:only_at]
only_levels = (only_at.instance_of?(Array) ? only_at : [only_at]).map{ |l| LNAMES.index(l) }
Outputter[outputter_name].only_at(*only_levels) if only_levels.size > 0
- 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 add
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def add(*_outputters)
for thing in _outputters
o = (thing.kind_of?(Outputter) ? thing : Outputter[thing])
# some basic validation
unless o.kind_of?(Outputter)
- 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 formatter=
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def formatter=(_formatter)
if _formatter.kind_of?(Formatter)
@formatter = _formatter
elsif _formatter.kind_of?(Class) and _formatter <= Formatter
if _formatter.respond_to? :instance
- 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 format_object
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def format_object(obj)
if obj.kind_of? Exception
return "Caught #{obj.class}: #{obj.message}\n\t" +
(obj.backtrace.nil? ? [] : obj.backtrace[0...@depth]).join("\n\t")
elsif obj.kind_of? String
- 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 check_config
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_config
# auto reload config every 30 seconds.
return unless check_again?
detect_existing_config_path
return if File.mtime(@config_path) == @config_time
- 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 all_children
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def all_children(parent)
# children have the parent name + delimiter in their fullname
daddy = parent.name + Log4r::Log4rConfig::LoggerPathDelimiter
synchronize do
for fullname, logger in instance.loggers
- 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 create_methods
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_methods(out, levels=nil)
Logger.root # force levels to be loaded
# first, undefine all the log levels
for mname in LNAMES
- 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 deal_with_inheritance
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def deal_with_inheritance(_level)
mypath = @fullname.split Log4rConfig::LoggerPathDelimiter
@name = mypath.pop
if mypath.empty? # then root is my daddy
@path = ""
- 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"