Showing 565 of 654 total issues
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 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 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 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 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 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 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 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 receive_lines
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def receive_lines(lines, tail_watcher)
lines = lines.reject do |line|
skip_line = @max_line_size ? line.bytesize > @max_line_size : false
if skip_line
log.warn "received line length is longer than #{@max_line_size}"
- 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 write
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def write(record)
unless secondary_record?(record)
if record.class != Hash
raise ArgumentError, "Input must be a map (got #{record.class})"
end
- 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 update_retry_state
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def update_retry_state(chunk_id, using_secondary, error = nil)
@retry_mutex.synchronize do
@num_errors_metrics.inc
chunk_id_hex = dump_unique_id_hex(chunk_id)
- 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 install_windows_event_handler
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def install_windows_event_handler
return unless Fluent.windows?
@pid_signame = "fluentd_#{Process.pid}"
@signame = config[:signame]
- 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 run_rpc_server
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def run_rpc_server
@rpc_server = RPC::Server.new(@rpc_endpoint, $log)
# built-in RPC for signals
@rpc_server.mount_proc('/api/processes.interruptWorkers') { |req, res|
- 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"