fluent/fluentd

View on GitHub

Showing 664 of 664 total issues

Method install_main_process_signal_handlers has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def install_main_process_signal_handlers
      # Fluentd worker process (worker of ServerEngine) don't use code in serverengine to set signal handlers,
      # because it does almost nothing.
      # This method is the only method to set signal handlers in Fluentd worker process.

Severity: Minor
Found in lib/fluent/supervisor.rb - About 1 hr to fix

    Method server_create_connection has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def server_create_connection(title, port, proto: nil, bind: '0.0.0.0', shared: true, backlog: nil, tls_options: nil, **socket_options, &block)
            proto ||= (@transport_config && @transport_config.protocol == :tls) ? :tls : :tcp
    
            raise ArgumentError, "BUG: title must be a symbol" unless title && title.is_a?(Symbol)
            raise ArgumentError, "BUG: port must be an integer" unless port && port.is_a?(Integer)
    Severity: Minor
    Found in lib/fluent/plugin_helper/server.rb - About 1 hr to fix

      Method parse has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

            def parse(text)
              parsed_json = @load_proc.call(text)
      
              if parsed_json.is_a?(Hash)
                time, record = parse_one_record(parsed_json)
      Severity: Minor
      Found in lib/fluent/plugin/parser_json.rb - About 1 hr 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 setup_watcher has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def setup_watcher(target_info, pe)
            line_buffer_timer_flusher = @multiline_mode ? TailWatcher::LineBufferTimerFlusher.new(log, @multiline_flush_interval, &method(:flush_buffer)) : nil
            read_from_head = !@startup || @read_from_head
            tw = TailWatcher.new(target_info, pe, log, read_from_head, @follow_inodes, method(:update_watcher), line_buffer_timer_flusher, method(:io_handler), @metrics)
      
      
      Severity: Minor
      Found in lib/fluent/plugin/in_tail.rb - About 1 hr 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 connect has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

            def connect(host:, port:, hostname:, ack: nil, &block)
              if @socket_cache
                return connect_keepalive(host: host, port: port, hostname: hostname, ack: ack, &block)
              end
      
      
      Severity: Minor
      Found in lib/fluent/plugin/out_forward/connection_manager.rb - About 1 hr 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 has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def run
            batch_num    = (@rate / BIN_NUM).to_i
            residual_num = (@rate % BIN_NUM)
            while thread_current_running?
              current_time = Time.now.to_i
      Severity: Minor
      Found in lib/fluent/plugin/in_sample.rb - About 1 hr 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 parse_plain has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

            def parse_plain(re, time, text, idx, record, capture_list, &block)
              m = re.match(text, idx)
              if m.nil?
                yield nil, nil
                return
      Severity: Minor
      Found in lib/fluent/plugin/parser_syslog.rb - About 1 hr 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 try_rollback_write has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

            def try_rollback_write
              @dequeued_chunks_mutex.synchronize do
                while @dequeued_chunks.first && @dequeued_chunks.first.expired?
                  info = @dequeued_chunks.shift
                  if @buffer.takeback_chunk(info.chunk_id)
      Severity: Minor
      Found in lib/fluent/plugin/output.rb - About 1 hr 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 parse_rfc5424_regex has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

            def parse_rfc5424_regex(text, &block)
              idx = 0
              record = {}
      
              if @with_priority
      Severity: Minor
      Found in lib/fluent/plugin/parser_syslog.rb - About 1 hr 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 initialize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize(type, format = nil, localtime = nil, timezone = nil, utc = nil, force_localtime = nil, fallbacks = [])
            @parsers = []
            fallbacks.unshift(format).each do |fallback|
              next unless fallback
              case fallback
      Severity: Minor
      Found in lib/fluent/time.rb - About 1 hr 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_worker has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def run_worker
            Process.setproctitle("worker:#{@system_config.process_name}") if @process_name
      
            if @standalone_worker && @system_config.workers != 1
              raise Fluent::ConfigError, "invalid number of workers (must be 1 or unspecified) with --no-supervisor: #{@system_config.workers}"
      Severity: Minor
      Found in lib/fluent/supervisor.rb - About 1 hr 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 filter_stream has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def filter_stream(tag, es)
            new_es = Fluent::MultiEventStream.new
            es.each do |time, record|
              begin
                raw_value = @accessor.call(record)
      Severity: Minor
      Found in lib/fluent/plugin/filter_parser.rb - About 1 hr 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 after_shutdown has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

            def after_shutdown
              try_rollback_all if @buffering && !@as_secondary # rollback regardless with @delayed_commit, because secondary may do it
              @secondary.after_shutdown if @secondary
      
              if @buffering && @buffer
      Severity: Minor
      Found in lib/fluent/plugin/output.rb - About 1 hr 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 configure has a Cognitive Complexity of 11 (exceeds 5 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

      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 configure has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

            def configure(conf)
              if conf.has_key?('localtime') || conf.has_key?('utc')
                if conf.has_key?('localtime')
                  conf['localtime'] = Fluent::Config.bool_value(conf['localtime'])
                elsif conf.has_key?('utc')
      Severity: Minor
      Found in lib/fluent/time.rb - About 1 hr 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 cancel_source_only has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def cancel_source_only
            if ENV.key?("FLUENT_RUNNING_IN_PARALLEL_WITH_OLD")
              if config[:rpc_endpoint]
                begin
                  @rpc_endpoint = config[:rpc_endpoint]
      Severity: Minor
      Found in lib/fluent/supervisor.rb - About 1 hr 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 main_process has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def main_process(&block)
            if @system_config.process_name
              if @system_config.workers > 1
                Process.setproctitle("worker:#{@system_config.process_name}#{ENV['SERVERENGINE_WORKER_ID']}")
              else
      Severity: Minor
      Found in lib/fluent/supervisor.rb - About 1 hr 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 handle_stream_simple has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

            def handle_stream_simple(tag, es, enqueue: false)
              if @overrides_emit
                current_emit_count = @emit_count_metrics.get
                size = es.size
                key = data = nil
      Severity: Minor
      Found in lib/fluent/compat/output.rb - About 1 hr 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 build has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.build(root_agent)
            log_event_router = nil
      
            begin
              log_event_agent = root_agent.find_label(Fluent::Log::LOG_EVENT_LABEL)
      Severity: Minor
      Found in lib/fluent/fluent_log_event_router.rb - About 1 hr 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 initialize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize
            super
            # to simulate implicit 'attr_accessor' by config_param / config_section and its value by config_set_default
            proxy = self.class.merged_configure_proxy
            proxy.params.each_key do |name|
      Severity: Minor
      Found in lib/fluent/configurable.rb - About 1 hr 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