Showing 577 of 664 total issues
Method configure
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def configure(conf)
super
unless @queue_limit_length.nil?
@total_limit_size = @chunk_limit_size * @queue_limit_length
Method <=>
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def <=>(o)
timekey2 = o.timekey
tag2 = o.tag
variables2 = o.variables
if (!!timekey ^ !!timekey2) || (!!tag ^ !!tag2) || (!!variables ^ !!variables2)
Method configure
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def configure(conf)
compat_parameters_convert(conf, :parser)
super
Method fetch_compacted_entries
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def fetch_compacted_entries
entries = {}
@file.pos = 0
file_pos = 0
Method parse
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.parse(str, fname, basepath = Dir.pwd, v1_config = nil, syntax: :v1)
parser = if fname =~ /\.rb$/ || syntax == :ruby
:ruby
elsif v1_config.nil?
case syntax
Method calc_next_time
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def calc_next_time
if @forever || !@secondary # primary
naive = naive_next_time(@steps)
if @forever
naive
Method format=
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def format=(fmt)
return if @format == fmt
@time_format = '%Y-%m-%d %H:%M:%S %z'
@time_formatter = Strftime.new(@time_format) rescue nil
Method shutdown
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def shutdown
@_child_process_mutex.synchronize{ @_child_process_processes.keys }.each do |pid|
process_info = @_child_process_processes[pid]
next if !process_info
process_info.writeio && process_info.writeio.close rescue nil
Method reload_config
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def reload_config(conf, supervisor: false)
@root_agent_mutex.synchronize do
# configure first to reduce down time while restarting
new_agent = RootAgent.new(log: log, system_config: @system_config)
ret = Fluent::StaticConfigAnalysis.call(conf, workers: system_config.workers)
Method scan_double_quoted_string
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def scan_double_quoted_string
string = []
while true
if skip(/\"/)
if string.include?(nil)
Consider simplifying this complex logical expression. Open
if (!!timekey ^ !!timekey2) || (!!tag ^ !!tag2) || (!!variables ^ !!variables2)
# One has value in a field, but another doesn't have value in same field
# This case occurs very rarely
if timekey == timekey2 # including the case of nil == nil
if tag == tag2
Method expand
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def expand(__str_to_eval__, tag, time, record, tag_parts, tag_prefix, tag_suffix, hostname)
Method send_request
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def send_request(uri, req)
res = if @reuse_connections
make_request_cached(uri, req)
else
make_request(uri, req) { |http| http.request(req) }
- 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 stop_watchers
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def stop_watchers(targets_info, immediate: false, unwatched: false, remove_watcher: true)
targets_info.each_value { |target_info|
remove_path_from_group_watcher(target_info.path)
if remove_watcher
- 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_path
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def generate_path(path_without_suffix)
if @append
path = "#{path_without_suffix}#{@suffix}"
synchronize_path(path) do
yield 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"
Further reading
Method connect_keepalive
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def connect_keepalive(host:, port:, hostname:, ack: nil)
request_info = RequestInfo.new(:established)
socket = @socket_cache.checkout_or([host, port, hostname]) do
s = @connection_factory.call(host, port, hostname)
request_info = RequestInfo.new(@secure ? :helo : :established) # overwrite if new connection
- 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_float
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parse_float(value)
unless value.is_a?(String) || value.is_a?(Numeric)
raise TimeParseError, "value must be a string or a number: #{value}(#{value.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 open
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def open(**kwargs, &block)
if kwargs[:compressed] == :gzip
super
else
super(**kwargs) do |chunk_io|
- 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_rfc3164_regex
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parse_rfc3164_regex(text, &block)
idx = 0
record = {}
if @with_priority
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
def self.formatter(timezone = nil, format = nil)
if timezone.nil?
return nil
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"