fluent/fluentd

View on GitHub

Showing 564 of 653 total issues

Avoid deeply nested control flow statements.
Open

                    @ignore_list << p if @ignore_repeated_permission_error
Severity: Major
Found in lib/fluent/plugin/in_tail.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                  pos = @read_from_head ? 0 : fsize
    Severity: Major
    Found in lib/fluent/plugin/in_tail.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                        if adding_bytes > @chunk_limit_size
                          errors << "concatenated/appended a #{adding_bytes} bytes record (nth: #{writing_splits_index}) is larger than buffer chunk limit size (#{@chunk_limit_size})"
                          writing_splits_index += 1
                          next
                        else
      Severity: Major
      Found in lib/fluent/plugin/buffer.rb - About 45 mins to fix

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

            def configure(conf)
              super
        
              unless @as_secondary
                raise Fluent::ConfigError, "This plugin can only be used in the <secondary> section"
        Severity: Minor
        Found in lib/fluent/plugin/out_secondary_file.rb - About 45 mins 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 ack_check has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def ack_check(select_interval)
              @ack_handler.collect_response(select_interval) do |chunk_id, node, sock, result|
                @connection_manager.close(sock)
        
                case result
        Severity: Minor
        Found in lib/fluent/plugin/out_forward.rb - About 45 mins 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 tick has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def tick
                now = Time.now.to_f
                unless available?
                  if @failure.hard_timeout?(now)
                    @failure.clear
        Severity: Minor
        Found in lib/fluent/plugin/out_forward.rb - About 45 mins 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 build has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.build(config_path:, encoding: 'utf-8', additional_config: nil, use_v1_config: true, type: nil)
              if type == :guess
                config_file_ext = File.extname(config_path)
                if config_file_ext == '.yaml' || config_file_ext == '.yml'
                  type = :yaml
        Severity: Minor
        Found in lib/fluent/config.rb - About 45 mins 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 enqueued! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                def enqueued!
                  return unless self.staged?
        
                  new_chunk_path = self.class.generate_queued_chunk_path(@path, @unique_id)
        
        
        Severity: Minor
        Found in lib/fluent/plugin/buffer/file_single_chunk.rb - About 45 mins 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 rollback_write has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def rollback_write(chunk_id, update_retry: true)
                # This API is to rollback chunks explicitly from plugins.
                # 3rd party plugins can depend it on automatic rollback of #try_rollback_write
                @dequeued_chunks_mutex.synchronize do
                  @dequeued_chunks.delete_if{ |info| info.chunk_id == chunk_id }
        Severity: Minor
        Found in lib/fluent/plugin/output.rb - About 45 mins 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 handle_stream_simple has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def handle_stream_simple(tag, es, enqueue: false)
                format_proc = nil
                meta = metadata((@chunk_key_tag ? tag : nil), nil, nil)
                records = es.size
                if @custom_format
        Severity: Minor
        Found in lib/fluent/plugin/output.rb - About 45 mins 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 handle_parsed has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def handle_parsed(tag, record, t, values)
              if values && @inject_key_prefix
                values = Hash[values.map { |k, v| [@inject_key_prefix + k, v] }]
              end
              r = @hash_value_field ? {@hash_value_field => values} : values
        Severity: Minor
        Found in lib/fluent/plugin/filter_parser.rb - About 45 mins 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 load has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def load(existing_targets = nil)
                compact(existing_targets)
        
                map = {}
                @file_mutex.synchronize do
        Severity: Minor
        Found in lib/fluent/plugin/in_tail/position_file.rb - About 45 mins 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 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def configure(conf, strict_config_value=false)
              @config = conf
        
              logger = if self.respond_to?(:log)
                         self.log
        Severity: Minor
        Found in lib/fluent/configurable.rb - About 45 mins 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 plugin_root_dir has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def plugin_root_dir
              return @_plugin_root_dir if @_plugin_root_dir
              return nil unless system_config.root_dir
              return nil unless plugin_id_configured?
        
        
        Severity: Minor
        Found in lib/fluent/plugin_id.rb - About 45 mins 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_keys has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def synchronize_keys(*keys)
                return if keys.empty?
                keys = keys.dup
        
                while key = keys.shift
        Severity: Minor
        Found in lib/fluent/counter/mutex_hash.rb - About 45 mins 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 static_worker_analyse has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def static_worker_analyse(conf)
              available_worker_ids = [*0...@workers]
        
              ret = []
              conf.elements(name: 'worker').each do |config|
        Severity: Minor
        Found in lib/fluent/static_config_analysis.rb - About 45 mins 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 server_attach has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def server_attach(title, proto, port, bind, shared, server)
        Severity: Minor
        Found in lib/fluent/plugin_helper/server.rb - About 45 mins to fix

          Method socket_create_tcp has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                def socket_create_tcp(host, port, resolve_name: false, connect_timeout: nil, **kwargs, &block)
                  sock = if connect_timeout
                           s = ::Socket.tcp(host, port, connect_timeout: connect_timeout)
                           s.autoclose = false # avoid GC triggered close
                           WrappedSocket::TCP.for_fd(s.fileno)
          Severity: Minor
          Found in lib/fluent/plugin_helper/socket.rb - About 45 mins 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_worker_id has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def parse_worker_id(conf)
                worker_id_str = conf.arg
          
                if worker_id_str.empty?
                  raise Fluent::ConfigError, 'Missing worker id on <worker> directive'
          Severity: Minor
          Found in lib/fluent/static_config_analysis.rb - About 45 mins 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 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def lifecycle(desc: false)
                kind_list = if desc
                              [:output, :filter, :output_with_router]
                            else
                              [:output_with_router, :filter, :output]
          Severity: Minor
          Found in lib/fluent/agent.rb - About 45 mins 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