fluent/fluentd

View on GitHub

Showing 565 of 654 total issues

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

              def lifecycle(desc: false, kind_callback: nil)
                kind_or_label_list = if desc
                              [:output, :filter, @labels.values.reverse, :output_with_router, :input].flatten
                            else
                              [:input, :output_with_router, @labels.values, :filter, :output].flatten
          Severity: Minor
          Found in lib/fluent/root_agent.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

          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 write_once has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def write_once(metadata, data, format: nil, size: nil, &block)
                  return if data.empty?
          
                  stored = false
                  adding_bytesize = nil
          Severity: Minor
          Found in lib/fluent/plugin/buffer.rb - About 1 hr to fix

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

              Method on_rotate has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def on_rotate(stat)
                      if @io_handler.nil?
                        if stat
                          # first time
                          fsize = stat.size
              Severity: Minor
              Found in lib/fluent/plugin/in_tail.rb - About 1 hr to fix

                Method get_monitor_info has 45 lines of code (exceeds 25 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 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language