fluent/fluentd

View on GitHub

Showing 664 of 664 total issues

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

                def read_lines(lines)
                  idx = @buffer.index(@eol)
                  has_skipped_line = false
        
                  until idx.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

        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 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 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 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 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 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 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 run_supervisor has 39 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 zero_downtime_restart has 39 lines of code (exceeds 25 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 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
                    Severity
                    Category
                    Status
                    Source
                    Language