fluent/fluentd

View on GitHub

Showing 577 of 664 total issues

Method start has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def start
      super

      log.info "listening udp socket", bind: @bind, port: @port
      server_create(:in_udp_server, @port, proto: :udp, bind: @bind, resolve_name: !!@source_hostname_key, max_bytes: @message_length_limit, receive_buffer_size: @receive_buffer_size) do |data, sock|
Severity: Minor
Found in lib/fluent/plugin/in_udp.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 preprocess_map has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

      def preprocess_map(value, force_stringify = false)
        new_value = nil
        if value.is_a?(String)
          if @auto_typecast && !force_stringify
            num_placeholders = value.scan('${').size
Severity: Minor
Found in lib/fluent/plugin/filter_record_transformer.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 synchronize has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

      def synchronize(*keys)
        return if keys.empty?

        locks = {}
        loop do
Severity: Minor
Found in lib/fluent/counter/mutex_hash.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 calc_next_time has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

        def calc_next_time
          if @forever || !@secondary # primary
            naive = naive_next_time(@steps)
            if @forever
              naive
Severity: Minor
Found in lib/fluent/plugin_helper/retry_state.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_parser has a Cognitive Complexity of 16 (exceeds 5 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 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 cert_option_create_context has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

      def cert_option_create_context(version, insecure, ciphers, conf)
        cert, key, extra = cert_option_server_validate!(conf)

        ctx = OpenSSL::SSL::SSLContext.new
        # inject OpenSSL::SSL::SSLContext::DEFAULT_PARAMS
Severity: Minor
Found in lib/fluent/plugin_helper/cert_option.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_extract has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

      def compat_parameters_extract(conf)
        return unless conf.elements('extract').empty?
        return if EXTRACT_PARAMS.keys.all?{|k| !conf.has_key?(k) } && !conf.has_key?('format')

        # TODO: warn obsolete parameters if these are deprecated
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 dump_config_definition has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

      def dump_config_definition
        dumped_config = {}
        if @argument
          argument_name, _block, options = @argument
          options[:required] = !@defaults.key?(argument_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 try_tls_accept has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

          def try_tls_accept
            return true if @_handler_accepted

            begin
              result = @_handler_socket.accept_nonblock(exception: false) # this method call actually try to do handshake via TLS
Severity: Minor
Found in lib/fluent/plugin_helper/server.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 scan_double_quoted_string has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

      def scan_double_quoted_string
        string = []
        while true
          if skip(/\"/)
            if string.include?(nil)
Severity: Minor
Found in lib/fluent/config/literal_parser.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 install_windows_event_handler has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def install_windows_event_handler
      return unless Fluent.windows?

      @pid_signame = "fluentd_#{Process.pid}"
      @signame = config[:signame]
Severity: Major
Found in lib/fluent/supervisor.rb - About 2 hrs to fix

    Method child_process_execute_once has 16 arguments (exceeds 4 allowed). Consider refactoring.
    Open

              title, command, arguments, subprocess_name, mode, stderr, env, unsetenv, chdir,
              internal_encoding, external_encoding, scrub, replace_string, wait_timeout, on_exit_callback, &block
    Severity: Major
    Found in lib/fluent/plugin_helper/child_process.rb - About 2 hrs to fix

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

          def configure(conf)
            super
      
            if @source_hostname_key
              # TODO: add test
      Severity: Minor
      Found in lib/fluent/plugin/in_forward.rb - About 1 hr to fix

        Method configure has 49 lines of code (exceeds 25 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 1 hr to fix

          Method handle_notify has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def handle_notify
                    if limit_bytes_per_second_reached? || group_watcher&.limit_lines_reached?(@path)
                      @metrics.throttled.inc
                      return
                    end
          Severity: Minor
          Found in lib/fluent/plugin/in_tail.rb - About 1 hr to fix

            Method parse has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                  def parse(text, &block)
                    loop do
                      m =
                        if @unmatched_lines
                          @parser.call(text) do |time, record|
            Severity: Minor
            Found in lib/fluent/plugin/parser_multiline.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 filter_stream has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                  def filter_stream(tag, es)
                    new_es = MultiEventStream.new
                    if @has_filter_with_time
                      es.each do |time, record|
                        begin
            Severity: Minor
            Found in lib/fluent/plugin/filter.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 before_run has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                def before_run
                  @fluentd_conf = config[:fluentd_conf]
                  @rpc_endpoint = nil
                  @rpc_server = nil
                  @counter = nil
            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

            Method parse_dot_array_op has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                    def self.parse_dot_array_op(key, param)
                      start = key.index('[')
                      result = if start.zero?
                                 []
                               else
            Severity: Minor
            Found in lib/fluent/plugin_helper/record_accessor.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 section_build has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                    def section_build(name, config, indent: 0, arg: nil)
                      sb = SectionBodyBuilder.new(indent + @base_indent)
            
                      if (v = config.delete('$type'))
                        sb.add_line('@type', v)
            Severity: Minor
            Found in lib/fluent/config/yaml_parser/parser.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