fluent/fluentd

View on GitHub

Showing 564 of 653 total issues

Method configure has a Cognitive Complexity of 32 (exceeds 5 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 4 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_rfc5424 has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

      def parse_rfc5424(text, &block)
        pri = nil
        cursor = 0
        if @with_priority
          if text.start_with?('<'.freeze)
Severity: Minor
Found in lib/fluent/plugin/parser_syslog.rb - About 4 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_rfc3164 has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

      def parse_rfc3164(text, &block)
        pri = nil
        cursor = 0
        if @with_priority
          if text.start_with?('<'.freeze)
Severity: Minor
Found in lib/fluent/plugin/parser_syslog.rb - About 4 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_formatter_conf has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

      def self.convert_formatter_conf(conf)
        return if conf.elements(name: 'inject').first || conf.elements(name: 'format').first

        inject_params = {}
        INJECT_PARAMS.each do |older, newer|
Severity: Minor
Found in lib/fluent/compat/formatter_utils.rb - About 4 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 setup_global_logger has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    def setup_global_logger(supervisor: false)
      if supervisor
        worker_id = 0
        process_type = :supervisor
      else
Severity: Minor
Found in lib/fluent/supervisor.rb - About 4 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_step_by_step has 116 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def write_step_by_step(metadata, data, format, splits_count, &block)
        splits = []
        if splits_count > data.size
          splits_count = data.size
        end
Severity: Major
Found in lib/fluent/plugin/buffer.rb - About 4 hrs to fix

    Method handle_notify has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

            def handle_notify
              return if limit_bytes_per_second_reached?
              return if group_watcher&.limit_lines_reached?(@path)
    
              with_io do |io|
    Severity: Minor
    Found in lib/fluent/plugin/in_tail.rb - About 4 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 31 (exceeds 5 allowed). Consider refactoring.
    Open

          def configure(conf)
            super
    
            @variable_store = Fluent::VariableStore.fetch_or_build(:buf_file_single)
    
    
    Severity: Minor
    Found in lib/fluent/plugin/buf_file_single.rb - About 4 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 extract_placeholders has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

          def extract_placeholders(str, chunk)
            metadata = if chunk.is_a?(Fluent::Plugin::Buffer::Chunk)
                         chunk_passed = true
                         chunk.metadata
                       else
    Severity: Minor
    Found in lib/fluent/plugin/output.rb - About 4 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 start has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

        def start
          super
    
          @children_mutex = Mutex.new
          @children = []
    Severity: Minor
    Found in lib/fluent/plugin/out_exec_filter.rb - About 4 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 30 (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 4 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 initialize has a Cognitive Complexity of 30 (exceeds 5 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: Minor
    Found in lib/fluent/match.rb - About 4 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 generate has 107 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def self.generate(proxy, conf, logger, plugin_class, stack = [], strict_config_value = false)
            return nil if conf.nil?
    
            section_stack = ""
            unless stack.empty?
    Severity: Major
    Found in lib/fluent/config/section.rb - About 4 hrs to fix

      Method flush_buffer has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

          def flush_buffer(tw, buf)
            buf.chomp!
            @parser.parse(buf) { |time, record|
              if time && record
                tag = if @tag_prefix || @tag_suffix
      Severity: Minor
      Found in lib/fluent/plugin/in_tail.rb - About 4 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_fast_internal has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

            def parse_fast_internal(text)
              record = {}
              text.chomp!
      
              return record if text.empty?
      Severity: Minor
      Found in lib/fluent/plugin/parser_csv.rb - About 4 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 optimized_filter_stream has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

              def optimized_filter_stream(tag, es)
                new_es = MultiEventStream.new
                es.each(unpacker: Fluent::MessagePackFactory.thread_local_msgpack_unpacker) do |time, record|
                  filtered_record = record
                  filtered_time = time
      Severity: Minor
      Found in lib/fluent/event_router.rb - About 4 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_bracket_notation has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

              def self.parse_bracket_notation(param)
                orig_param = param
                result = []
                param = param[1..-1]
                in_bracket = false
      Severity: Minor
      Found in lib/fluent/plugin_helper/record_accessor.rb - About 4 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

      Class FluentPluginGenerator has 32 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class FluentPluginGenerator
        attr_reader :type, :name
        attr_reader :license_name
      
        SUPPORTED_TYPES = ["input", "output", "filter", "parser", "formatter", "storage"]
      Severity: Minor
      Found in lib/fluent/command/plugin_generator.rb - About 4 hrs to fix

        Method parse_rfc5424 has 98 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def parse_rfc5424(text, &block)
                pri = nil
                cursor = 0
                if @with_priority
                  if text.start_with?('<'.freeze)
        Severity: Major
        Found in lib/fluent/plugin/parser_syslog.rb - About 3 hrs to fix

          Method try_flush has a Cognitive Complexity of 27 (exceeds 5 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: 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

          Severity
          Category
          Status
          Source
          Language