fluent/fluentd

View on GitHub

Showing 565 of 654 total issues

Method parse has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def parse(text)
        m = REGEXP.match(text)
        unless m
          yield nil, nil
          return
Severity: Minor
Found in lib/fluent/plugin/parser_apache2.rb - About 1 hr to fix

    Method read_ack_from_sock has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def read_ack_from_sock(sock)
            begin
              raw_data = sock.instance_of?(Fluent::PluginHelper::Socket::WrappedSocket::TLS) ? sock.readpartial(@read_length) : sock.recv(@read_length)
            rescue Errno::ECONNRESET, EOFError # ECONNRESET for #recv, #EOFError for #readpartial
              raw_data = ''
    Severity: Minor
    Found in lib/fluent/plugin/out_forward/ack_handler.rb - About 1 hr to fix

      Method parse_rfc5424_regex has 33 lines of code (exceeds 25 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

        Method compat_parameters_parser has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def compat_parameters_parser(conf)
                return unless conf.elements('parse').empty?
                return if PARSER_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 1 hr to fix

          Method parse! has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def parse!(allow_include, elem_name = nil, attrs = {}, elems = [])
                  while line = @iterator.next
                    line.force_encoding('UTF-8')
                    @i += 1
                    line.lstrip!
          Severity: Minor
          Found in lib/fluent/config/parser.rb - About 1 hr to fix

            Method establish_connection has 32 lines of code (exceeds 25 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 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 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 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 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 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 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 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 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 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 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 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 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

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

                      def initialize(title, wait, timeout, forever, max_steps, randomize, randomize_width, secondary, secondary_threshold)
                        @title = title
              
                        @start = current_time
                        @steps = 0
              Severity: Minor
              Found in lib/fluent/plugin_helper/retry_state.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

              Severity
              Category
              Status
              Source
              Language