fluent/fluentd

View on GitHub

Showing 565 of 654 total issues

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

    def run_supervisor(dry_run: false)
      if dry_run
        $log.info "starting fluentd-#{Fluent::VERSION} as dry run mode", ruby: RUBY_VERSION
      end

Severity: Minor
Found in lib/fluent/supervisor.rb - About 1 hr to fix

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

          def socket_option_set(sock, resolve_name: nil, nonblock: false, linger_timeout: nil, recv_timeout: nil, send_timeout: nil, receive_buffer_size: nil, send_keepalive_packet: nil)
            unless resolve_name.nil?
              sock.do_not_reverse_lookup = !resolve_name
            end
            if nonblock
    Severity: Minor
    Found in lib/fluent/plugin_helper/socket_option.rb - About 1 hr to fix

      Method build_object has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

            def build_object(opts)
              qs = opts[:query]
              if tag = qs['tag'.freeze].first
                # ?tag= to search an output plugin by match pattern
                if obj = @agent.plugin_info_by_tag(tag, opts)
      Severity: Minor
      Found in lib/fluent/plugin/in_monitor_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 with_io has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

              def with_io
                if @open_on_every_update
                  io = open
                  begin
                    yield io
      Severity: Minor
      Found in lib/fluent/plugin/in_tail.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 configure has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def configure(conf)
            compat_parameters_convert(conf, :parser)
      
            super
      
      
      Severity: Minor
      Found in lib/fluent/plugin/in_syslog.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 convert_values has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

            def convert_values(time, record)
              return time, record unless @execute_convert_values
      
              record.each_key do |key|
                value = record[key]
      Severity: Minor
      Found in lib/fluent/plugin/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 on_record has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def on_record(time, record)
            tag = extract_tag_from_record(record)
            tag = @added_prefix_string + tag if tag && @add_prefix
            tag ||= @tag
            time ||= extract_time_from_record(record) || Fluent::EventTime.now
      Severity: Minor
      Found in lib/fluent/plugin/out_exec_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 on_timer has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def on_timer
            now = Fluent::EventTime.now
      
            array = []
            map = {}
      Severity: Minor
      Found in lib/fluent/plugin/in_object_space.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 try_rollback_all has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

            def try_rollback_all
              return unless @dequeued_chunks
              @dequeued_chunks_mutex.synchronize do
                until @dequeued_chunks.empty?
                  info = @dequeued_chunks.shift
      Severity: Minor
      Found in lib/fluent/plugin/output.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 parser_create has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

            def parser_create(usage: '', type: nil, conf: nil, default_type: nil)
              parser = @_parsers[usage]
              return parser if parser && !type && !conf
      
              type = if type
      Severity: Minor
      Found in lib/fluent/plugin_helper/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 formatter_create has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

            def formatter_create(usage: '', type: nil, conf: nil, default_type: nil)
              formatter = @_formatters[usage]
              return formatter if formatter && !type && !conf
      
              type = if type
      Severity: Minor
      Found in lib/fluent/plugin_helper/formatter.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_multilines has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def parse_multilines(lines, tail_watcher)
            lb = tail_watcher.line_buffer_timer_flusher.line_buffer
            es = Fluent::MultiEventStream.new
            if @parser.has_firstline?
              tail_watcher.line_buffer_timer_flusher.reset_timer
      Severity: Minor
      Found in lib/fluent/plugin/in_tail.rb - About 1 hr to fix

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

            def configure(conf)
              compat_parameters_convert(conf, :parser)
              parser_config = conf.elements('parse').first
              unless parser_config
                raise Fluent::ConfigError, "<parse> section is required."
        Severity: Minor
        Found in lib/fluent/plugin/in_tcp.rb - About 1 hr to fix

          Method create_transfer_socket has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def create_transfer_socket(host, port, hostname, &block)
                case @transport
                when :tls
                  socket_create_tls(
                    host, port,
          Severity: Minor
          Found in lib/fluent/plugin/out_forward.rb - About 1 hr to fix

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

              Method thread_create has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def thread_create(title)
                      raise ArgumentError, "BUG: title must be a symbol" unless title.is_a? Symbol
                      raise ArgumentError, "BUG: callback not specified" unless block_given?
                      m = Mutex.new
                      m.lock
              Severity: Minor
              Found in lib/fluent/plugin_helper/thread.rb - About 1 hr to fix

                Method initialize has 11 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        def initialize(title, wait, timeout, forever, max_steps, randomize, randomize_width, backoff_base, max_interval, secondary, secondary_threshold)
                Severity: Major
                Found in lib/fluent/plugin_helper/retry_state.rb - About 1 hr to fix

                  Method tls_verify_result_name has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def self.tls_verify_result_name(code)
                          case code
                          when OpenSSL::X509::V_OK then 'V_OK'
                          when OpenSSL::X509::V_ERR_AKID_SKID_MISMATCH then 'V_ERR_AKID_SKID_MISMATCH'
                          when OpenSSL::X509::V_ERR_APPLICATION_VERIFICATION then 'V_ERR_APPLICATION_VERIFICATION'
                  Severity: Minor
                  Found in lib/fluent/plugin_helper/socket.rb - About 1 hr to fix

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

                      Method prepare_option_parser has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def prepare_option_parser
                          @parser = OptionParser.new
                          @parser.version = Fluent::VERSION
                          @parser.banner = <<BANNER
                      Usage: #{$0} [options] <type> <name>
                      Severity: Minor
                      Found in lib/fluent/command/plugin_config_formatter.rb - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language