fluent/fluentd

View on GitHub

Showing 564 of 653 total issues

Method install_main_process_command_handlers has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def install_main_process_command_handlers
      command_pipe = $stdin.dup
      $stdin.reopen(File::NULL, "rb")
      command_pipe.binmode
      command_pipe.sync = true
Severity: Minor
Found in lib/fluent/supervisor.rb - About 1 hr to fix

    Method install_main_process_signal_handlers has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def install_main_process_signal_handlers
          # Fluentd worker process (worker of ServerEngine) don't use code in serverengine to set signal handlers,
          # because it does almost nothing.
          # This method is the only method to set signal handlers in Fluentd worker process.
    
    
    Severity: Minor
    Found in lib/fluent/supervisor.rb - About 1 hr to fix

      Method parse_dot_array_op has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def self.parse_dot_array_op(key, param)
                start = key.index('[')
                result = if start.zero?
                           []
                         else
      Severity: Minor
      Found in lib/fluent/plugin_helper/record_accessor.rb - About 1 hr to fix

        Method eval_include has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def eval_include(attrs, elems, uri)
                # replace space(s)(' ') with '+' to prevent invalid uri due to space(s).
                # See: https://github.com/fluent/fluentd/pull/2780#issuecomment-576081212
                u = URI.parse(uri.tr(' ', '+'))
                if u.scheme == 'file' || (!u.scheme.nil? && u.scheme.length == 1) || u.path == uri.tr(' ', '+') # file path
        Severity: Minor
        Found in lib/fluent/config/v1_parser.rb - About 1 hr to fix

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

                def initialize(target_info, pe, log, read_from_head, follow_inodes, update_watcher, line_buffer_timer_flusher, io_handler_build, metrics)
          Severity: Major
          Found in lib/fluent/plugin/in_tail.rb - About 1 hr to fix

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

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

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

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

                Method update_watcher has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def update_watcher(tail_watcher, pe, new_inode)
                      # TODO we should use another callback for this.
                      # To supress impact to existing logics, limit the case to `@follow_inodes`.
                      # We may not need `@follow_inodes` condition.
                      if @follow_inodes && new_inode.nil?
                Severity: Minor
                Found in lib/fluent/plugin/in_tail.rb - About 1 hr to fix

                  Method refresh_watchers has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def refresh_watchers
                        target_paths_hash = expand_paths
                        existence_paths_hash = existence_path
                  
                        log.debug {
                  Severity: Minor
                  Found in lib/fluent/plugin/in_tail.rb - About 1 hr to fix

                    Method read_messages has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def read_messages(conn, &block)
                          feeder = nil
                          serializer = nil
                          bytes = 0
                          conn.data do |data|
                    Severity: Minor
                    Found in lib/fluent/plugin/in_forward.rb - About 1 hr to fix

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

                        Method supervise has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def supervise
                              Process.setproctitle("supervisor:#{@system_config.process_name}") if @system_config.process_name
                              $log.info "starting fluentd-#{Fluent::VERSION}", pid: Process.pid, ruby: RUBY_VERSION
                        
                              fluentd_spawn_cmd = build_spawn_command
                        Severity: Minor
                        Found in lib/fluent/supervisor.rb - About 1 hr to fix

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

                            Method initialize has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    def initialize(title, wait, timeout, forever, max_steps, randomize, randomize_width, secondary, secondary_threshold)
                                      @title = title
                            
                                      @start = current_time
                                      @steps = 0
                            Severity: Minor
                            Found in lib/fluent/plugin_helper/retry_state.rb - About 1 hr to fix

                              Method mount_proc has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                    def mount_proc(path, &block)
                                      @server.mount_proc(path) { |req, res|
                                        begin
                                          code, header, response = block.call(req, res)
                                        rescue => e
                              Severity: Minor
                              Found in lib/fluent/rpc.rb - About 1 hr to fix

                                Method call has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        def call(request)
                                          method = request.method
                                          resp =
                                            case method
                                            when HttpServer::Methods::GET
                                Severity: Minor
                                Found in lib/fluent/plugin_helper/http_server/app.rb - About 1 hr to fix

                                  Method compat_parameters_inject has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                        def compat_parameters_inject(conf)
                                          return unless conf.elements('inject').empty?
                                          return if INJECT_PARAMS.keys.all?{|k| !conf.has_key?(k) }
                                  
                                          # TODO: warn obsolete parameters if these are deprecated
                                  Severity: Minor
                                  Found in lib/fluent/plugin_helper/compat_parameters.rb - About 1 hr to fix

                                    Method collect_response has a Cognitive Complexity of 10 (exceeds 5 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

                                    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 purge_chunk has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                          def purge_chunk(chunk_id)
                                            metadata = nil
                                            synchronize do
                                              chunk = @dequeued.delete(chunk_id)
                                              return nil unless chunk # purged by other threads
                                    Severity: Minor
                                    Found in lib/fluent/plugin/buffer.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 update_watcher has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        def update_watcher(tail_watcher, pe, new_inode)
                                          # TODO we should use another callback for this.
                                          # To supress impact to existing logics, limit the case to `@follow_inodes`.
                                          # We may not need `@follow_inodes` condition.
                                          if @follow_inodes && new_inode.nil?
                                    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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language