fluent/fluentd

View on GitHub

Showing 577 of 664 total issues

Method get_monitor_info has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def get_monitor_info(pe, opts={})
      obj = {}

      # Common plugin information
      obj['plugin_id'] = pe.plugin_id
Severity: Minor
Found in lib/fluent/plugin/in_monitor_agent.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 21 (exceeds 5 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 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 parse_multilines has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def parse_multilines(lines, tail_watcher)
      lb = tail_watcher.line_buffer_timer_flusher.line_buffer
      es = Fluent::MultiEventStream.new
      if @parser.has_firstline?
        tail_watcher.line_buffer_timer_flusher.reset_timer
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 71 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 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

    Method run_rpc_server has 67 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def run_rpc_server
          @rpc_server = RPC::Server.new(@rpc_endpoint, $log)
    
          # built-in RPC for signals
          @rpc_server.mount_proc('/api/processes.interruptWorkers') { |req, res|
    Severity: Major
    Found in lib/fluent/supervisor.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 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

          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

            Method setup_global_logger has 66 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

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

                    def run_supervisor(dry_run: false)
                      if dry_run
                        $log.info "starting fluentd-#{Fluent::VERSION} as dry run mode", ruby: RUBY_VERSION
                      end
                
                
                Severity: Minor
                Found in lib/fluent/supervisor.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

                Severity
                Category
                Status
                Source
                Language