fluent/fluentd

View on GitHub

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 = {}
Severity: Major
Found in lib/fluent/plugin/filter_grep.rb - About 2 hrs to fix

    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
    Severity: Minor
    Found in lib/fluent/config/element.rb - About 2 hrs to fix

      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"))
      Severity: Major
      Found in lib/fluent/plugin/filter_parser.rb - About 2 hrs to fix

        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)
        
        
        Severity: Major
        Found in lib/fluent/plugin/buf_file_single.rb - About 2 hrs to fix

          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
          Severity: Major
          Found in lib/fluent/plugin/output.rb - About 2 hrs to fix

            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|
            Severity: Major
            Found in lib/fluent/supervisor.rb - About 2 hrs to fix

              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?
              Severity: Minor
              Found in lib/fluent/plugin/buffer.rb - About 2 hrs to fix

              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.
              Severity: Minor
              Found in lib/fluent/plugin/out_forward.rb - About 2 hrs to fix

              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)
              Severity: Minor
              Found in lib/fluent/counter/mutex_hash.rb - About 2 hrs to fix

              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
              Severity: Minor
              Found in lib/fluent/config/configure_proxy.rb - About 2 hrs to fix

              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
              Severity: Minor
              Found in lib/fluent/plugin_helper/compat_parameters.rb - About 2 hrs to fix

              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
              Severity: Major
              Found in lib/fluent/plugin/in_tail.rb - About 2 hrs to fix

                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'
                Severity: Minor
                Found in lib/fluent/plugin/out_file.rb - About 2 hrs to fix

                  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
                  Severity: Minor
                  Found in lib/fluent/plugin_helper/compat_parameters.rb - About 2 hrs to fix

                    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"
                    Severity: Minor
                    Found in lib/fluent/command/plugin_config_formatter.rb - About 2 hrs to fix

                      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']
                      Severity: Minor
                      Found in lib/fluent/supervisor.rb - About 2 hrs to fix

                        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
                        Severity: Minor
                        Found in lib/fluent/config/configure_proxy.rb - About 2 hrs to fix

                          Method start has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                def start
                                  super
                          
                                  if @buffering.nil?
                                    @buffering = prefer_buffered_processing
                          Severity: Major
                          Found in lib/fluent/plugin/output.rb - About 2 hrs to fix

                            Method start has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def start
                                  super
                            
                                  @children_mutex = Mutex.new
                                  @children = []
                            Severity: Major
                            Found in lib/fluent/plugin/out_exec_filter.rb - About 2 hrs to fix

                              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 = []
                              Severity: Minor
                              Found in lib/fluent/command/plugin_config_formatter.rb - About 2 hrs to fix

                              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

                              Severity
                              Category
                              Status
                              Source
                              Language