lib/fluent/config/section.rb
Method generate
has a Cognitive Complexity of 138 (exceeds 5 allowed). Consider refactoring. Open
Open
def self.generate(proxy, conf, logger, plugin_class, stack = [], strict_config_value = false)
return nil if conf.nil?
section_stack = ""
unless stack.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 generate
has 107 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.generate(proxy, conf, logger, plugin_class, stack = [], strict_config_value = false)
return nil if conf.nil?
section_stack = ""
unless stack.empty?
Method check_unused_section
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
Open
def self.check_unused_section(proxy, conf, plugin_class)
elems = conf.respond_to?(:elements) ? conf.elements : []
elems.each { |e|
next if plugin_class.nil? && Fluent::Config::V1Parser::ELEM_SYMBOLS.include?(e.name) # skip pre-defined non-plugin elements because it doesn't have proxy section
next if e.unused_in && e.unused_in.empty? # the section is used at least once
- 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
Avoid deeply nested control flow statements. Open
Open
logger.error "config error in:\n#{conf}" if logger
Method generate
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def self.generate(proxy, conf, logger, plugin_class, stack = [], strict_config_value = false)
Avoid deeply nested control flow statements. Open
Open
logger.error "config error in:\n#{conf}" if logger