fluent/fluentd

View on GitHub

Showing 664 of 664 total issues

Method receive_lines has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def receive_lines(lines, tail_watcher)
      es = @receive_handler.call(lines, tail_watcher)
      unless es.empty?
        tag = if @tag_prefix || @tag_suffix
                @tag_prefix + tail_watcher.tag + @tag_suffix
Severity: Minor
Found in lib/fluent/plugin/in_tail.rb - About 45 mins 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

Avoid deeply nested control flow statements.
Open

              pos = @read_from_head ? 0 : fsize
Severity: Major
Found in lib/fluent/plugin/in_tail.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                      if adding_bytes > @chunk_limit_size
                        errors << "concatenated/appended a #{adding_bytes} bytes record (nth: #{writing_splits_index}) is larger than buffer chunk limit size (#{@chunk_limit_size})"
                        writing_splits_index += 1
                        next
                      else
    Severity: Major
    Found in lib/fluent/plugin/buffer.rb - About 45 mins to fix

      Method detach_watcher_after_rotate_wait has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def detach_watcher_after_rotate_wait(tw, ino)
            # Call event_loop_attach/event_loop_detach is high-cost for short-live object.
            # If this has a problem with large number of files, use @_event_loop directly instead of timer_execute.
            if @open_on_every_update
              # Detach now because it's already closed, waiting it doesn't make sense.
      Severity: Minor
      Found in lib/fluent/plugin/in_tail.rb - About 45 mins 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

      Avoid deeply nested control flow statements.
      Open

                      break if merged_col.end_with?(@quote_char)
      Severity: Major
      Found in lib/fluent/plugin/parser_csv.rb - About 45 mins to fix

        Method check_pong has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def check_pong(ri, message)
                @log.debug('checking pong')
                # ['PONG', bool(authentication result), 'reason if authentication failed',
                #  self_hostname, sha512\_hex(salt + self_hostname + nonce + sharedkey)]
                unless message.size == 5 && message[0] == 'PONG'
        Severity: Minor
        Found in lib/fluent/plugin/out_forward/handshake_protocol.rb - About 45 mins 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

        Avoid deeply nested control flow statements.
        Open

                            @ignore_list << p if @ignore_repeated_permission_error
        Severity: Major
        Found in lib/fluent/plugin/in_tail.rb - About 45 mins to fix

          Method configure has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def configure(conf)
                super
          
                unless @as_secondary
                  raise Fluent::ConfigError, "This plugin can only be used in the <secondary> section"
          Severity: Minor
          Found in lib/fluent/plugin/out_secondary_file.rb - About 45 mins 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 start has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def start
                super
          
                if @pos_file
                  pos_file_dir = File.dirname(@pos_file)
          Severity: Minor
          Found in lib/fluent/plugin/in_tail.rb - About 45 mins 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_parsed has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def handle_parsed(tag, record, t, values)
                if values && @inject_key_prefix
                  values = Hash[values.map { |k, v| [@inject_key_prefix + k, v] }]
                end
                r = @hash_value_field ? {@hash_value_field => values} : values
          Severity: Minor
          Found in lib/fluent/plugin/filter_parser.rb - About 45 mins 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 tick has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                def tick
                  now = Time.now.to_f
                  unless available?
                    if @failure.hard_timeout?(now)
                      @failure.clear
          Severity: Minor
          Found in lib/fluent/plugin/out_forward.rb - About 45 mins 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 enqueued! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                  def enqueued!
                    return unless self.staged?
          
                    new_chunk_path = self.class.generate_queued_chunk_path(@path, @unique_id)
          
          
          Severity: Minor
          Found in lib/fluent/plugin/buffer/file_single_chunk.rb - About 45 mins 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 ack_check has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def ack_check(select_interval)
                @ack_handler.collect_response(select_interval) do |chunk_id, node, sock, result|
                  @connection_manager.close(sock)
          
                  case result
          Severity: Minor
          Found in lib/fluent/plugin/out_forward.rb - About 45 mins 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 rollback_write has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                def rollback_write(chunk_id, update_retry: true)
                  # This API is to rollback chunks explicitly from plugins.
                  # 3rd party plugins can depend it on automatic rollback of #try_rollback_write
                  @dequeued_chunks_mutex.synchronize do
                    @dequeued_chunks.delete_if{ |info| info.chunk_id == chunk_id }
          Severity: Minor
          Found in lib/fluent/plugin/output.rb - About 45 mins 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 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def self.build(config_path:, encoding: 'utf-8', additional_config: nil, use_v1_config: true, type: nil)
                if type == :guess
                  config_file_ext = File.extname(config_path)
                  if config_file_ext == '.yaml' || config_file_ext == '.yml'
                    type = :yaml
          Severity: Minor
          Found in lib/fluent/config.rb - About 45 mins 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 8 (exceeds 5 allowed). Consider refactoring.
          Open

                def handle_stream_simple(tag, es, enqueue: false)
                  format_proc = nil
                  meta = metadata((@chunk_key_tag ? tag : nil), nil, nil)
                  records = es.size
                  if @custom_format
          Severity: Minor
          Found in lib/fluent/plugin/output.rb - About 45 mins 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 load has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                def load(existing_targets = nil)
                  compact(existing_targets)
          
                  map = {}
                  @file_mutex.synchronize do
          Severity: Minor
          Found in lib/fluent/plugin/in_tail/position_file.rb - About 45 mins 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 notify_new_supervisor_that_old_one_has_stopped has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def notify_new_supervisor_that_old_one_has_stopped
                if config[:pid_path]
                  new_pid = File.read(config[:pid_path]).to_i
                else
                  raise "[BUG] new_supervisor_pid is not saved" unless @new_supervisor_pid
          Severity: Minor
          Found in lib/fluent/supervisor.rb - About 45 mins 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 lifecycle has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def lifecycle(desc: false)
                kind_list = if desc
                              [:output, :filter, :output_with_router]
                            else
                              [:output_with_router, :filter, :output]
          Severity: Minor
          Found in lib/fluent/agent.rb - About 45 mins 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 synchronize_keys has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                def synchronize_keys(*keys)
                  return if keys.empty?
                  keys = keys.dup
          
                  while key = keys.shift
          Severity: Minor
          Found in lib/fluent/counter/mutex_hash.rb - About 45 mins 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