fluent/fluentd

View on GitHub

Showing 565 of 654 total issues

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

    def configure(conf)
      super

      # initialize <match> and <filter> elements
      conf.elements('filter', 'match').each { |e|
Severity: Minor
Found in lib/fluent/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 start has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def start
      @thread = Thread.new do
        $log.disable_events(Thread.current)

        loop do
Severity: Minor
Found in lib/fluent/fluent_log_event_router.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 config_parameter_option_validate! has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def config_parameter_option_validate!(name, type, **kwargs, &block)
        if type.nil? && !block
          type = :string
        end
        kwargs.each_key do |key|
Severity: Minor
Found in lib/fluent/config/configure_proxy.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 cert_option_server_validate! has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def cert_option_server_validate!(conf)
        case
        when conf.cert_path
          raise Fluent::ConfigError, "private_key_path is required when cert_path is specified" unless conf.private_key_path
          log.warn "For security reason, setting private_key_passphrase is recommended when cert_path is specified" unless conf.private_key_passphrase
Severity: Minor
Found in lib/fluent/plugin_helper/cert_option.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 parameter_configuration has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def parameter_configuration(name, type = nil, **kwargs, &block)
        config_parameter_option_validate!(name, type, **kwargs, &block)

        name = name.to_sym

Severity: Minor
Found in lib/fluent/config/configure_proxy.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 collect_response has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def collect_response(select_interval)
        now = Fluent::Clock.now
        sockets = []
        results = []
        begin
Severity: Minor
Found in lib/fluent/plugin/out_forward/ack_handler.rb - About 1 hr to fix

    Method event has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def event(level, args)
          time = Time.now
          message = @optional_header ? @optional_header.dup : ''
          map = @optional_attrs ? @optional_attrs.dup : {}
          args.each {|a|
    Severity: Minor
    Found in lib/fluent/log.rb - About 1 hr to fix

      Method handle_stream_simple has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def handle_stream_simple(tag, es, enqueue: false)
              if @overrides_emit
                current_emit_count = @emit_count_metrics.get
                size = es.size
                key = data = nil
      Severity: Minor
      Found in lib/fluent/compat/output.rb - About 1 hr to fix

        Method main_process has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def main_process(&block)
              if @system_config.process_name
                if @system_config.workers > 1
                  Process.setproctitle("worker:#{@system_config.process_name}#{ENV['SERVERENGINE_WORKER_ID']}")
                else
        Severity: Minor
        Found in lib/fluent/supervisor.rb - About 1 hr to fix

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

            Method message_handler has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def message_handler(data, sock)
                  pri = nil
                  text = data
                  unless @parser_parse_priority
                    m = SYSLOG_REGEXP.match(data)
            Severity: Minor
            Found in lib/fluent/plugin/in_syslog.rb - About 1 hr to fix

              Method compat_parameters_buffer has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def compat_parameters_buffer(conf, default_chunk_key: '')
                      # return immediately if <buffer> section exists, or any buffer-related parameters don't exist
                      return unless conf.elements('buffer').empty?
                      return if (BUFFER_PARAMS.keys + BUFFER_TIME_SLICED_PARAMS.keys).all?{|k| !conf.has_key?(k) }
              
              
              Severity: Minor
              Found in lib/fluent/plugin_helper/compat_parameters.rb - About 1 hr to fix

                Method parameter_configuration has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def parameter_configuration(name, type = nil, **kwargs, &block)
                        config_parameter_option_validate!(name, type, **kwargs, &block)
                
                        name = name.to_sym
                
                
                Severity: Minor
                Found in lib/fluent/config/configure_proxy.rb - About 1 hr to fix

                  Method merge has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def merge(other) # self is base class, other is subclass
                          return merge_for_finalized(other) if self.final?
                  
                          [:param_name, :required, :multi, :alias, :configured_in_section].each do |prohibited_name|
                            if overwrite?(other, prohibited_name)
                  Severity: Minor
                  Found in lib/fluent/config/configure_proxy.rb - About 1 hr to fix

                    Method scan_json has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def scan_json(is_array)
                            result = nil
                            # Yajl does not raise ParseError for incomplete json string, like '[1', '{"h"', '{"h":' or '{"h1":1'
                            # This is the reason to use JSON module.
                    
                    
                    Severity: Minor
                    Found in lib/fluent/config/literal_parser.rb - About 1 hr to fix

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

                        Method build_type_converters has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              def build_type_converters(types)
                                return nil unless types
                        
                                converters = {}
                        
                        
                        Severity: Minor
                        Found in lib/fluent/plugin/parser.rb - About 1 hr to fix

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

                            Method write_guard has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                  def write_guard(&block)
                                    begin
                                      block.call
                                    rescue Fluent::Plugin::Buffer::BufferOverflowError
                                      log.warn "failed to write data into buffer by buffer overflow", action: @buffer_config.overflow_action
                            Severity: Minor
                            Found in lib/fluent/plugin/output.rb - About 1 hr to fix

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

                                  def configure(conf)
                                    exec_filter_compat_parameters_convert!(conf)
                                    compat_parameters_convert(conf, :buffer)
                              
                                    if inject_section = conf.elements('inject').first
                              Severity: Minor
                              Found in lib/fluent/plugin/out_exec_filter.rb - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language