Showing 577 of 664 total issues
Method scan_json
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def scan_json(is_array)
result = nil
# Yajl does not raise ParseError for incomplete json string, like '[1', '{"h"', '{"h":' or '{"h1":1'
# This is the reason to use JSON module.
Method configure
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def configure(conf)
super
@connection_cache = Array.new(actual_flush_thread_count, ConnectionCache.new("", nil)) if @reuse_connections
Consider simplifying this complex logical expression. Open
if MIN_MAX_AVAILABLE
case
when min_version.nil? && max_version.nil?
min_version = METHODS_MAP[version] || version
max_version = METHODS_MAP[version] || version
Method parse_fast_internal
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_fast_internal(text)
record = {}
text.chomp!
return record if text.empty?
Method rebuild_weight_array
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def rebuild_weight_array(nodes)
standby_nodes, regular_nodes = nodes.select { |e| e.weight > 0 }.partition {|n|
n.standby?
}
Method initialize
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(format = nil, localtime = true, timezone = nil)
if format.nil? && (timezone || !localtime)
raise Fluent::ConfigError, "specifying timezone requires time format"
end
Method resume
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def resume
stage = {}
queue = []
exist_broken_file = false
Method handle_connection
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle_connection(conn)
send_data = ->(serializer, data){ conn.write serializer.call(data) }
log.trace "connected fluent socket", addr: conn.remote_addr, port: conn.remote_port
state = :established
Method initialize
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize
super
@counter_mutex = Mutex.new
@flush_thread_mutex = Mutex.new
@buffering = false
Method configure
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def configure(conf)
super
@regexp_parser = @parser_engine == :regexp
@regexp = case @message_format
Method before_run
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def before_run
@fluentd_conf = config[:fluentd_conf]
@rpc_endpoint = nil
@rpc_server = nil
@counter = nil
Method serverengine_config
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.serverengine_config(params = {})
# ServerEngine's "daemonize" option is boolean, and path of pid file is brought by "pid_path"
pid_path = params['daemonize']
daemonize = !!params['daemonize']
Method convert_formatter_conf
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.convert_formatter_conf(conf)
return if conf.elements(name: 'inject').first || conf.elements(name: 'format').first
inject_params = {}
INJECT_PARAMS.each do |older, newer|
Method configure
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def configure(conf)
super
if @inject_config
@_inject_hostname_key = @inject_config.hostname_key
Method child_process_execute
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def child_process_execute(
title, command,
arguments: nil, subprocess_name: nil, interval: nil, immediate: false, parallel: false,
mode: [:read, :write], stderr: :discard, env: {}, unsetenv: false, chdir: nil,
internal_encoding: 'utf-8', external_encoding: 'ascii-8bit', scrub: true, replace_string: nil,
Method merge_for_finalized
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def merge_for_finalized(other)
# list what subclass can do for finalized section
# * append params/defaults/sections which are missing in superclass
# * change default values of superclass
# * overwrite init to make it enable to instantiate section objects with added default values
Method storage_create
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def storage_create(usage: '', type: nil, conf: nil, default_type: nil)
if conf && conf.respond_to?(:arg) && !conf.arg.empty?
usage = conf.arg
end
if !usage.empty? && usage !~ /^[a-zA-Z][-_.a-zA-Z0-9]*$/
Method parse_options!
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def parse_options!
@opt_parser.parse!(@argv)
@command = @argv[0]
@pid_or_svcname = @argv[1] || "fluentdwinsvc"
- 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 call
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def call
parse_options!
init_libraries
@plugin = Fluent::Plugin.__send__("new_#{@plugin_type}", @plugin_name)
dumped_config = {}
- 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 read_lines
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def read_lines(lines)
idx = @buffer.index(@eol)
has_skipped_line = false
until idx.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"