Showing 565 of 654 total issues
Method configure
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def configure(conf)
super
regexp_and_conditions = {}
regexp_or_conditions = {}
Class Element
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Element < Hash
def initialize(name, arg, attrs, elements, unused = nil)
@name = name
@arg = arg
@elements = elements
Method filter_with_time
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
def filter_with_time(tag, time, record)
raw_value = @accessor.call(record)
if raw_value.nil?
if @emit_invalid_record_to_error
router.emit_error_event(tag, time, record, ArgumentError.new("#{@key_name} does not exist"))
Method configure
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
def configure(conf)
super
@variable_store = Fluent::VariableStore.fetch_or_build(:buf_file_single)
Method extract_placeholders
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
def extract_placeholders(str, chunk)
metadata = if chunk.is_a?(Fluent::Plugin::Buffer::Chunk)
chunk_passed = true
chunk.metadata
else
Method run_rpc_server
has 62 lines of code (exceeds 25 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|
Method enqueue_all
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def enqueue_all(force_enqueue = false)
log.on_trace { log.trace "enqueueing all chunks in buffer", instance: self.object_id }
update_timekeys if @enable_update_timekeys
if block_given?
- 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 establish_connection
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def establish_connection(sock, ri)
while ri.state != :established
begin
# TODO: On Ruby 2.2 or earlier, read_nonblock doesn't work expectedly.
# We need rewrite around here using new socket/server plugin helper.
- 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_once
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def run_once
@mutex.synchronize do
last_cleanup_at = (Time.now - CLEANUP_INTERVAL).to_i
@mutex_hash.each do |(key, mutex)|
v = @store.get(key, raw: true)
- 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 merge_for_finalized
has a Cognitive Complexity of 18 (exceeds 5 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
- 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 compat_parameters_inject
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def compat_parameters_inject(conf)
return unless conf.elements('inject').empty?
return if INJECT_PARAMS.keys.all?{|k| !conf.has_key?(k) }
# TODO: warn obsolete parameters if these are deprecated
- 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 expand_paths
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
def expand_paths
date = Fluent::EventTime.now
paths = []
@paths.each { |path|
path = if @path_timezone
File out_file.rb
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'fileutils'
require 'zlib'
require 'time'
require 'fluent/plugin/output'
File compat_parameters.rb
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'fluent/config/types'
require 'fluent/config/element'
module Fluent
module PluginHelper
File plugin_config_formatter.rb
has 264 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "erb"
require "optparse"
require "pathname"
require "fluent/plugin"
require "fluent/env"
Class Supervisor
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Supervisor
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']
Class ConfigureProxy
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class ConfigureProxy
attr_accessor :name, :final, :param_name, :init, :required, :multi, :alias, :configured_in_section
attr_accessor :argument, :params, :defaults, :descriptions, :sections
# config_param :desc, :string, default: '....'
# config_set_default :buffer_type, :memory
Method start
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
def start
super
if @buffering.nil?
@buffering = prefer_buffered_processing
Method start
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def start
super
@children_mutex = Mutex.new
@children = []
Method dump_section_txt
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def dump_section_txt(base_section, level = 0)
dumped = ""
indent = " " * level
if base_section[:section]
sections = []
- 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"