fluent/fluentd

View on GitHub

Showing 565 of 654 total issues

Method generate_path_template has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def generate_path_template(original, timekey, append, compress, path_suffix: '', time_slice_format: nil)
      comp_suffix = compression_suffix(compress)
      index_placeholder = append ? '' : '_**'
      if original.index('*')
        raise "BUG: configuration error must be raised for path including '*' without timekey" unless timekey
Severity: Minor
Found in lib/fluent/plugin/out_file.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 resume has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

      def resume
        stage = {}
        queue = []
        exist_broken_file = false

Severity: Minor
Found in lib/fluent/plugin/buf_file_single.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 flush_thread_run has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

      def flush_thread_run(state)
        flush_thread_interval = @buffer_config.flush_thread_interval

        state.next_clock = Fluent::Clock.now + flush_thread_interval

Severity: Minor
Found in lib/fluent/plugin/output.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 configure has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

      def configure(conf)
        bufconf = CompatOutputUtils.buffer_section(conf)
        config_style = (bufconf ? :v1 : :v0)
        if config_style == :v0
          buf_params = {
Severity: Minor
Found in lib/fluent/compat/output.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 storage_create has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

      def storage_create(usage: '', type: nil, conf: nil, default_type: nil)
        if conf && conf.respond_to?(:arg) && !conf.arg.empty?
          usage = conf.arg
        end
        if !usage.empty? && usage !~ /^[a-zA-Z][-_.a-zA-Z0-9]*$/
Severity: Minor
Found in lib/fluent/plugin_helper/storage.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_buffer has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

      def compat_parameters_buffer(conf, default_chunk_key: '')
        # return immediately if <buffer> section exists, or any buffer-related parameters don't exist
        return unless conf.elements('buffer').empty?
        return if (BUFFER_PARAMS.keys + BUFFER_TIME_SLICED_PARAMS.keys).all?{|k| !conf.has_key?(k) }

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

File root_agent.rb has 279 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'delegate'

require 'fluent/config/error'
require 'fluent/agent'
require 'fluent/label'
Severity: Minor
Found in lib/fluent/root_agent.rb - About 2 hrs to fix

    File cat.rb has 278 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'optparse'
    require 'fluent/env'
    require 'fluent/time'
    require 'fluent/msgpack_factory'
    require 'fluent/version'
    Severity: Minor
    Found in lib/fluent/command/cat.rb - About 2 hrs to fix

      Class FileSingleChunk has 24 methods (exceeds 20 allowed). Consider refactoring.
      Open

            class FileSingleChunk < Chunk
              class FileChunkError < StandardError; end
      
              ## buffer path user specified : /path/to/directory
              ## buffer chunk path          : /path/to/directory/fsb.key.b513b61c9791029c2513b61c9791029c2.buf
      Severity: Minor
      Found in lib/fluent/plugin/buffer/file_single_chunk.rb - About 2 hrs to fix

        Class ForwardOutput has 24 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class ForwardOutput < Output
            Fluent::Plugin.register_output('forward', self)
        
            helpers :socket, :server, :timer, :thread, :compat_parameters, :service_discovery
        
        
        Severity: Minor
        Found in lib/fluent/plugin/out_forward.rb - About 2 hrs to fix

          File storage.rb has 276 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'forwardable'
          
          require 'fluent/plugin'
          require 'fluent/plugin/storage'
          require 'fluent/plugin_helper/timer'
          Severity: Minor
          Found in lib/fluent/plugin_helper/storage.rb - About 2 hrs to fix

            Method setup_global_logger has 65 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def setup_global_logger(supervisor: false)
                  if supervisor
                    worker_id = 0
                    process_type = :supervisor
                  else
            Severity: Major
            Found in lib/fluent/supervisor.rb - About 2 hrs to fix

              Method call has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                def call
                  parse_options!
                  FileUtils.mkdir_p(gem_name)
                  Dir.chdir(gem_name) do
                    copy_license
              Severity: Minor
              Found in lib/fluent/command/plugin_generator.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 convert_line_to_event has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                  def convert_line_to_event(line, es, tail_watcher)
                    begin
                      line.chomp!  # remove \n
                      @parser.parse(line) { |time, record|
                        if time && record
              Severity: Minor
              Found in lib/fluent/plugin/in_tail.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 configure has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                  def configure(conf)
                    exec_filter_compat_parameters_convert!(conf)
                    compat_parameters_convert(conf, :buffer)
              
                    if inject_section = conf.elements('inject').first
              Severity: Minor
              Found in lib/fluent/plugin/out_exec_filter.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 has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                    def merge(other) # self is base class, other is subclass
                      return merge_for_finalized(other) if self.final?
              
                      [:param_name, :required, :multi, :alias, :configured_in_section].each do |prohibited_name|
                        if overwrite?(other, prohibited_name)
              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 shutdown has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                    def shutdown
                      @_child_process_mutex.synchronize{ @_child_process_processes.keys }.each do |pid|
                        process_info = @_child_process_processes[pid]
                        next if !process_info
                        process_info.writeio && process_info.writeio.close rescue nil
              Severity: Minor
              Found in lib/fluent/plugin_helper/child_process.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 configure has 64 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def configure(conf)
                    compat_parameters_convert(conf, :formatter, :buffer, :inject, default_chunk_key: "time")
              
                    configured_time_slice_format = conf['time_slice_format']
              
              
              Severity: Major
              Found in lib/fluent/plugin/out_file.rb - About 2 hrs to fix

                Method on_message has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def on_message(msg, chunk_size, conn)
                      if msg.nil?
                        # for future TCP heartbeat_request
                        return
                      end
                Severity: Major
                Found in lib/fluent/plugin/in_forward.rb - About 2 hrs to fix

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

                      def initialize(pat)
                        if pat.start_with?('/')
                          if pat.end_with?('/')
                            @regex = Regexp.new("\\A"+pat[1..-2]+"\\Z")
                            return
                  Severity: Major
                  Found in lib/fluent/match.rb - About 2 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language