fluent/fluentd

View on GitHub

Showing 664 of 664 total issues

File configure_proxy.rb has 310 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Fluent
  module Config
    class ConfigureProxy
      attr_accessor :name, :final, :param_name, :init, :required, :multi, :alias, :configured_in_section
      attr_accessor :argument, :params, :defaults, :descriptions, :sections
Severity: Minor
Found in lib/fluent/config/configure_proxy.rb - About 3 hrs to fix

    Method setup_http_option has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

        def setup_http_option
          use_ssl = @endpoint.start_with?('https')
          opt = {
            open_timeout: @open_timeout,
            read_timeout: @read_timeout,
    Severity: Minor
    Found in lib/fluent/plugin/out_http.rb - About 3 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 enqueue_thread_run has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

          def enqueue_thread_run
            value_for_interval = nil
            if @flush_mode == :interval
              value_for_interval = @buffer_config.flush_interval
            end
    Severity: Minor
    Found in lib/fluent/plugin/output.rb - About 3 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 24 (exceeds 5 allowed). Consider refactoring.
    Open

        def configure(conf)
          compat_parameters_convert(conf, :parser)
          parser_config = conf.elements('parse').first
          unless parser_config
            raise Fluent::ConfigError, "<parse> section is required."
    Severity: Minor
    Found in lib/fluent/plugin/in_tcp.rb - About 3 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 fetch_compacted_entries has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

          def fetch_compacted_entries
            entries = {}
    
            @file.pos = 0
            file_pos = 0
    Severity: Minor
    Found in lib/fluent/plugin/in_tail/position_file.rb - About 3 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 try_flush has 82 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def try_flush
            chunk = @buffer.dequeue_chunk
            return unless chunk
    
            log.on_trace { log.trace "trying flush for a chunk", chunk: dump_unique_id_hex(chunk.unique_id) }
    Severity: Major
    Found in lib/fluent/plugin/output.rb - About 3 hrs to fix

      Method configure has 82 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def configure(conf)
            used_worker_ids = []
            available_worker_ids = (0..Fluent::Engine.system_config.workers - 1).to_a
            # initialize <worker> elements
            conf.elements(name: 'worker').each do |e|
      Severity: Major
      Found in lib/fluent/root_agent.rb - About 3 hrs to fix

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

              def configure(conf)
                super
        
                @variable_store = Fluent::VariableStore.fetch_or_build(:buf_file)
        
        
        Severity: Minor
        Found in lib/fluent/plugin/buf_file.rb - About 3 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 23 (exceeds 5 allowed). Consider refactoring.
        Open

              def resume
                stage = {}
                queue = []
                exist_broken_file = false
        
        
        Severity: Minor
        Found in lib/fluent/plugin/buf_file.rb - About 3 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 write_guard has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

              def write_guard(&block)
                begin
                  block.call
                rescue Fluent::Plugin::Buffer::BufferOverflowError
                  log.warn "failed to write data into buffer by buffer overflow", action: @buffer_config.overflow_action
        Severity: Minor
        Found in lib/fluent/plugin/output.rb - About 3 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 23 (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 3 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 event has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            def event(level, args)
              time = Time.now
              message = @optional_header ? @optional_header.dup : ''
              map = @optional_attrs ? @optional_attrs.dup : {}
              args.each {|a|
        Severity: Minor
        Found in lib/fluent/log.rb - About 3 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 child_process_execute has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

              def child_process_execute(
                  title, command,
                  arguments: nil, subprocess_name: nil, interval: nil, immediate: false, parallel: false,
                  mode: [:read, :write], stderr: :discard, env: {}, unsetenv: false, chdir: nil,
                  internal_encoding: 'utf-8', external_encoding: 'ascii-8bit', scrub: true, replace_string: nil,
        Severity: Minor
        Found in lib/fluent/plugin_helper/child_process.rb - About 3 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 80 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def configure(conf)
              compat_parameters_convert(conf, :buffer, default_chunk_key: 'tag')
        
              super
        
        
        Severity: Major
        Found in lib/fluent/plugin/out_forward.rb - About 3 hrs to fix

          Method cmp_variables has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

                  def cmp_variables(v1, v2)
                    if v1.nil? && v2.nil?
                      return 0
                    elsif v1.nil? # v2 is non-nil
                      return -1
          Severity: Minor
          Found in lib/fluent/plugin/buffer.rb - About 3 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 metadata has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

                def metadata(tag, time, record)
                  # this arguments are ordered in output plugin's rule
                  # Metadata 's argument order is different from this one (timekey, tag, variables)
          
                  raise ArgumentError, "tag must be a String: #{tag.class}" unless tag.nil? || tag.is_a?(String)
          Severity: Minor
          Found in lib/fluent/plugin/output.rb - About 3 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! has a Cognitive Complexity of 22 (exceeds 5 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 3 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 plugin_generator.rb has 294 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require "optparse"
          require "pathname"
          require "fileutils"
          require "erb"
          require "open-uri"
          Severity: Minor
          Found in lib/fluent/command/plugin_generator.rb - About 3 hrs to fix

            File fluentd.rb has 293 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require 'optparse'
            
            require 'fluent/supervisor'
            require 'fluent/log'
            require 'fluent/env'
            Severity: Minor
            Found in lib/fluent/command/fluentd.rb - About 3 hrs to fix

              File child_process.rb has 291 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require 'fluent/plugin_helper/thread'
              require 'fluent/plugin_helper/timer'
              require 'fluent/clock'
              
              require 'open3'
              Severity: Minor
              Found in lib/fluent/plugin_helper/child_process.rb - About 3 hrs to fix
                Severity
                Category
                Status
                Source
                Language