fluent/fluentd

View on GitHub

Showing 664 of 664 total issues

Method try_write has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def try_write(chunk)
tmpfile = nil
prog = if chunk.respond_to?(:path)
"#{@command} #{chunk.path}"
else
Severity: Minor
Found in lib/fluent/plugin/out_exec.rb - About 1 hr to fix

Method find has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def find(tag)
pipeline = nil
@match_rules.each do |rule|
if rule.match?(tag)
if rule.collector.is_a?(Plugin::Filter)
Severity: Minor
Found in lib/fluent/event_router.rb - About 1 hr to fix

Method socket_option_set has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def socket_option_set(sock, resolve_name: nil, nonblock: false, linger_timeout: nil, recv_timeout: nil, send_timeout: nil, receive_buffer_size: nil, send_keepalive_packet: nil)
unless resolve_name.nil?
sock.do_not_reverse_lookup = !resolve_name
end
if nonblock
Severity: Minor
Found in lib/fluent/plugin_helper/socket_option.rb - About 1 hr to fix

Method values_map has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def values_map(values)
record = Hash[keys.zip(values.map { |value| convert_value_to_nil(value) })]
 
if @time_key
value = @keep_time_key ? record[@time_key] : record.delete(@time_key)
Severity: Minor
Found in lib/fluent/compat/parser.rb - About 1 hr to fix

Method run_configure has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def run_configure(conf, dry_run: false)
configure(conf)
conf.check_not_fetched do |key, e|
parent_name, plugin_name = e.unused_in
message = if parent_name && plugin_name
Severity: Minor
Found in lib/fluent/engine.rb - About 1 hr to fix

Method initialize has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def initialize(logger, opts={})
# When ServerEngine changes the logger.level, the Fluentd logger level should also change.
# So overwrites logger.level= below.
# However, currently Fluentd doesn't use the ServerEngine's reloading feature,
# so maybe we don't need this overwriting anymore.
Severity: Minor
Found in lib/fluent/log.rb - About 1 hr to fix

    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.
     
     
    Severity: Minor
    Found in lib/fluent/config/literal_parser.rb - About 1 hr to fix

      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
       
       
      Severity: Minor
      Found in lib/fluent/plugin/out_http.rb - About 1 hr to fix

        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
        Severity: Critical
        Found in lib/fluent/tls.rb - About 1 hr to fix

          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?
          Severity: Minor
          Found in lib/fluent/plugin/parser_csv.rb - About 1 hr to fix

            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?
            }
             
             
            Severity: Minor
            Found in lib/fluent/plugin/out_forward/load_balancer.rb - About 1 hr to fix

              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
               
               
              Severity: Minor
              Found in lib/fluent/time.rb - About 1 hr to fix

                Method resume has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                def resume
                stage = {}
                queue = []
                exist_broken_file = false
                 
                 
                Severity: Minor
                Found in lib/fluent/plugin/buf_file_single.rb - About 1 hr to fix

                  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
                  Severity: Minor
                  Found in lib/fluent/plugin/in_forward.rb - About 1 hr to fix

                    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
                    Severity: Minor
                    Found in lib/fluent/plugin/output.rb - About 1 hr to fix

                      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
                      Severity: Minor
                      Found in lib/fluent/plugin/parser_syslog.rb - About 1 hr to fix

                        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
                        Severity: Minor
                        Found in lib/fluent/supervisor.rb - About 1 hr to fix

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

                            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|
                            Severity: Minor
                            Found in lib/fluent/compat/formatter_utils.rb - About 1 hr to fix

                              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
                              Severity: Minor
                              Found in lib/fluent/plugin_helper/inject.rb - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language