fluent/fluentd

View on GitHub

Showing 577 of 664 total issues

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

Method filter_one_record has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    def filter_one_record(tag, time, record, raw_value)
      begin
        @parser.parse(raw_value) do |t, values|
          if values
            t = if @reserve_time
Severity: Minor
Found in lib/fluent/plugin/filter_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

Method zero_downtime_restart has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    def zero_downtime_restart
      Thread.new do
        @zero_downtime_restart_mutex.synchronize do
          $log.info "start zero-downtime-restart sequence"

Severity: Minor
Found in lib/fluent/supervisor.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

Class TailInput has 31 methods (exceeds 20 allowed). Consider refactoring.
Open

  class TailInput < Fluent::Plugin::Input
    include GroupWatch

    Fluent::Plugin.register_input('tail', self)

Severity: Minor
Found in lib/fluent/plugin/in_tail.rb - About 3 hrs to fix

    Class Base has 31 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class Base
          include Configurable
          include SystemConfig::Mixin
    
          State = Struct.new(:configure, :start, :after_start, :stop, :before_shutdown, :shutdown, :after_shutdown, :close, :terminate)
    Severity: Minor
    Found in lib/fluent/plugin/base.rb - About 3 hrs to fix

      Method write has 95 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def write(metadata_and_data, format: nil, size: nil, enqueue: false)
              return if metadata_and_data.size < 1
              raise BufferOverflowError, "buffer space has too many data" unless storable?
      
              log.on_trace { log.trace "writing events into buffer", instance: self.object_id, metadata_size: metadata_and_data.size }
      Severity: Major
      Found in lib/fluent/plugin/buffer.rb - About 3 hrs to fix

        Method socket_create_tls has 95 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def socket_create_tls(
                  host, port,
                  version: Fluent::TLS::DEFAULT_VERSION, min_version: nil, max_version: nil, ciphers: Fluent::TLS::CIPHERS_DEFAULT, insecure: false, verify_fqdn: true, fqdn: nil,
                  enable_system_cert_store: true, allow_self_signed_cert: false, cert_paths: nil,
                  cert_path: nil, private_key_path: nil, private_key_passphrase: nil,
        Severity: Major
        Found in lib/fluent/plugin_helper/socket.rb - About 3 hrs to fix

          File out_http.rb has 324 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'net/http'
          require 'uri'
          require 'openssl'
          require 'fluent/tls'
          require 'fluent/plugin/output'
          Severity: Minor
          Found in lib/fluent/plugin/out_http.rb - About 3 hrs to fix

            Method start_tcp_server has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

                def start_tcp_server(tls: false)
                  octet_count_frame = @frame_type == :octet_count
            
                  delimiter = octet_count_frame ? " " : @delimiter
                  delimiter_size = delimiter.size
            Severity: Minor
            Found in lib/fluent/plugin/in_syslog.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 26 (exceeds 5 allowed). Consider refactoring.
            Open

                def configure(conf)
                  @variable_store = Fluent::VariableStore.fetch_or_build(:in_tail)
                  compat_parameters_convert(conf, :parser)
                  parser_config = conf.elements('parse').first
                  unless parser_config
            Severity: Minor
            Found in lib/fluent/plugin/in_tail.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 dump_stacktrace has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

                def dump_stacktrace(type, backtrace, level)
                  return if @level > level
            
                  time = Time.now
            
            
            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 search has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

                def search(type)
                  # search from additional plugin directories
                  if @dir_search_prefix
                    path = "#{@dir_search_prefix}#{type}"
                    files = @paths.filter_map { |lp|
            Severity: Minor
            Found in lib/fluent/registry.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 server_create_connection has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

                  def server_create_connection(title, port, proto: nil, bind: '0.0.0.0', shared: true, backlog: nil, tls_options: nil, **socket_options, &block)
                    proto ||= (@transport_config && @transport_config.protocol == :tls) ? :tls : :tcp
            
                    raise ArgumentError, "BUG: title must be a symbol" unless title && title.is_a?(Symbol)
                    raise ArgumentError, "BUG: port must be an integer" unless port && port.is_a?(Integer)
            Severity: Minor
            Found in lib/fluent/plugin_helper/server.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 find_filepath_available has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
            Open

                def find_filepath_available(path_with_placeholder, with_lock: false) # for non-append
                  raise "BUG: index placeholder not found in path: #{path_with_placeholder}" unless path_with_placeholder.index('_**')
                  i = 0
                  dir_path = locked = nil
                  while true
            Severity: Minor
            Found in lib/fluent/plugin/out_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

            Class Chunk has 29 methods (exceeds 20 allowed). Consider refactoring.
            Open

                  class Chunk
                    include MonitorMixin
                    include UniqueId::Mixin
            
                    # Chunks has 2 part:
            Severity: Minor
            Found in lib/fluent/plugin/buffer/chunk.rb - About 3 hrs to fix

              File in_monitor_agent.rb has 312 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require 'json'
              require 'webrick'
              require 'cgi'
              
              require 'fluent/config/types'
              Severity: Minor
              Found in lib/fluent/plugin/in_monitor_agent.rb - About 3 hrs to fix

                Method start has 87 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def start
                      super
                
                      log.info "listening tcp socket", bind: @bind, port: @port
                      del_size = @delimiter.length
                Severity: Major
                Found in lib/fluent/plugin/in_tcp.rb - About 3 hrs to fix

                  Method parse_rfc3164 has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def parse_rfc3164(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

                    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

                      Severity
                      Category
                      Status
                      Source
                      Language