fluent/fluentd

View on GitHub

Showing 565 of 654 total issues

Method rebuild_weight_array has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def rebuild_weight_array(nodes)
        standby_nodes, regular_nodes = nodes.select { |e| e.weight > 0 }.partition {|n|
          n.standby?
        }

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

    Method parse_fast_internal has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def parse_fast_internal(text)
            record = {}
            text.chomp!
    
            return record if text.empty?
    Severity: Minor
    Found in lib/fluent/plugin/parser_csv.rb - About 1 hr to fix

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

          def initialize(format = nil, localtime = true, timezone = nil)
            if format.nil? && (timezone || !localtime)
              raise Fluent::ConfigError, "specifying timezone requires time format"
            end
      
      
      Severity: Minor
      Found in lib/fluent/time.rb - About 1 hr to fix

        Method resume has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def resume
                stage = {}
                queue = []
                exist_broken_file = false
        
        
        Severity: Minor
        Found in lib/fluent/plugin/buf_file_single.rb - About 1 hr to fix

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

                def configure(conf)
                  super
          
                  @regexp_parser = @parser_engine == :regexp
                  @regexp = case @message_format
          Severity: Minor
          Found in lib/fluent/plugin/parser_syslog.rb - About 1 hr to fix

            Method handle_connection has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def handle_connection(conn)
                  send_data = ->(serializer, data){ conn.write serializer.call(data) }
            
                  log.trace "connected fluent socket", addr: conn.remote_addr, port: conn.remote_port
                  state = :established
            Severity: Minor
            Found in lib/fluent/plugin/in_forward.rb - About 1 hr to fix

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

                    def initialize
                      super
                      @counter_mutex = Mutex.new
                      @flush_thread_mutex = Mutex.new
                      @buffering = false
              Severity: Minor
              Found in lib/fluent/plugin/output.rb - About 1 hr to fix

                Method convert_formatter_conf has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def self.convert_formatter_conf(conf)
                        return if conf.elements(name: 'inject').first || conf.elements(name: 'format').first
                
                        inject_params = {}
                        INJECT_PARAMS.each do |older, newer|
                Severity: Minor
                Found in lib/fluent/compat/formatter_utils.rb - About 1 hr to fix

                  Method serverengine_config has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def self.serverengine_config(params = {})
                        # ServerEngine's "daemonize" option is boolean, and path of pid file is brought by "pid_path"
                        pid_path = params['daemonize']
                        daemonize = !!params['daemonize']
                  
                  
                  Severity: Minor
                  Found in lib/fluent/supervisor.rb - About 1 hr to fix

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

                          def configure(conf)
                            super
                    
                            if @inject_config
                              @_inject_hostname_key = @inject_config.hostname_key
                    Severity: Minor
                    Found in lib/fluent/plugin_helper/inject.rb - About 1 hr to fix

                      Method child_process_execute has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            def child_process_execute(
                                title, command,
                                arguments: nil, subprocess_name: nil, interval: nil, immediate: false, parallel: false,
                                mode: [:read, :write], stderr: :discard, env: {}, unsetenv: false, chdir: nil,
                                internal_encoding: 'utf-8', external_encoding: 'ascii-8bit', scrub: true, replace_string: nil,
                      Severity: Minor
                      Found in lib/fluent/plugin_helper/child_process.rb - About 1 hr to fix

                        Method merge_for_finalized has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              def merge_for_finalized(other)
                                # list what subclass can do for finalized section
                                #  * append params/defaults/sections which are missing in superclass
                                #  * change default values of superclass
                                #  * overwrite init to make it enable to instantiate section objects with added default values
                        Severity: Minor
                        Found in lib/fluent/config/configure_proxy.rb - About 1 hr to fix

                          Method storage_create has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                def storage_create(usage: '', type: nil, conf: nil, default_type: nil)
                                  if conf && conf.respond_to?(:arg) && !conf.arg.empty?
                                    usage = conf.arg
                                  end
                                  if !usage.empty? && usage !~ /^[a-zA-Z][-_.a-zA-Z0-9]*$/
                          Severity: Minor
                          Found in lib/fluent/plugin_helper/storage.rb - About 1 hr to fix

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

                                def parse_options!
                                  @opt_parser.parse!(@argv)
                            
                                  @command = @argv[0]
                                  @pid_or_svcname = @argv[1] || "fluentdwinsvc"
                            Severity: Minor
                            Found in lib/fluent/command/ctl.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 call has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def call
                                parse_options!
                                init_libraries
                                @plugin = Fluent::Plugin.__send__("new_#{@plugin_type}", @plugin_name)
                                dumped_config = {}
                            Severity: Minor
                            Found in lib/fluent/command/plugin_config_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 receive_lines has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def receive_lines(lines, tail_watcher)
                                  lines = lines.reject do |line|
                                    skip_line = @max_line_size ? line.bytesize > @max_line_size : false
                                    if skip_line
                                      log.warn "received line length is longer than #{@max_line_size}"
                            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 write has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def write(record)
                                unless secondary_record?(record)
                                  if record.class != Hash
                                    raise ArgumentError, "Input must be a map (got #{record.class})"
                                  end
                            Severity: Minor
                            Found in lib/fluent/command/cat.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_retry_state has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                            Open

                                  def update_retry_state(chunk_id, using_secondary, error = nil)
                                    @retry_mutex.synchronize do
                                      @num_errors_metrics.inc
                                      chunk_id_hex = dump_unique_id_hex(chunk_id)
                            
                            
                            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 install_windows_event_handler has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def install_windows_event_handler
                                  return unless Fluent.windows?
                            
                                  @pid_signame = "fluentd_#{Process.pid}"
                                  @signame = config[:signame]
                            Severity: Minor
                            Found in lib/fluent/supervisor.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 run_rpc_server has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def run_rpc_server
                                  @rpc_server = RPC::Server.new(@rpc_endpoint, $log)
                            
                                  # built-in RPC for signals
                                  @rpc_server.mount_proc('/api/processes.interruptWorkers') { |req, res|
                            Severity: Minor
                            Found in lib/fluent/supervisor.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