fluent/fluentd

View on GitHub

Showing 577 of 664 total issues

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

      def configure(conf)
        super

        unless @queue_limit_length.nil?
          @total_limit_size = @chunk_limit_size * @queue_limit_length
Severity: Minor
Found in lib/fluent/plugin/buffer.rb - About 1 hr to fix

    Method <=> has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def <=>(o)
              timekey2 = o.timekey
              tag2 = o.tag
              variables2 = o.variables
              if (!!timekey ^ !!timekey2) || (!!tag ^ !!tag2) || (!!variables ^ !!variables2)
    Severity: Minor
    Found in lib/fluent/plugin/buffer.rb - About 1 hr to fix

      Method configure has 26 lines of code (exceeds 25 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

        Method fetch_compacted_entries has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def fetch_compacted_entries
                entries = {}
        
                @file.pos = 0
                file_pos = 0
        Severity: Minor
        Found in lib/fluent/plugin/in_tail/position_file.rb - About 1 hr to fix

          Method parse has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def self.parse(str, fname, basepath = Dir.pwd, v1_config = nil, syntax: :v1)
                parser = if fname =~ /\.rb$/ || syntax == :ruby
                           :ruby
                         elsif v1_config.nil?
                           case syntax
          Severity: Minor
          Found in lib/fluent/config.rb - About 1 hr to fix

            Method calc_next_time has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def calc_next_time
                      if @forever || !@secondary # primary
                        naive = naive_next_time(@steps)
                        if @forever
                          naive
            Severity: Minor
            Found in lib/fluent/plugin_helper/retry_state.rb - About 1 hr to fix

              Method format= has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def format=(fmt)
                    return if @format == fmt
              
                    @time_format = '%Y-%m-%d %H:%M:%S %z'
                    @time_formatter = Strftime.new(@time_format) rescue nil
              Severity: Minor
              Found in lib/fluent/log.rb - About 1 hr to fix

                Method shutdown has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def shutdown
                        @_child_process_mutex.synchronize{ @_child_process_processes.keys }.each do |pid|
                          process_info = @_child_process_processes[pid]
                          next if !process_info
                          process_info.writeio && process_info.writeio.close rescue nil
                Severity: Minor
                Found in lib/fluent/plugin_helper/child_process.rb - About 1 hr to fix

                  Method reload_config has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def reload_config(conf, supervisor: false)
                        @root_agent_mutex.synchronize do
                          # configure first to reduce down time while restarting
                          new_agent = RootAgent.new(log: log, system_config: @system_config)
                          ret = Fluent::StaticConfigAnalysis.call(conf, workers: system_config.workers)
                  Severity: Minor
                  Found in lib/fluent/engine.rb - About 1 hr to fix

                    Method scan_double_quoted_string has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def scan_double_quoted_string
                            string = []
                            while true
                              if skip(/\"/)
                                if string.include?(nil)
                    Severity: Minor
                    Found in lib/fluent/config/literal_parser.rb - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                                if (!!timekey ^ !!timekey2) || (!!tag ^ !!tag2) || (!!variables ^ !!variables2)
                                  # One has value in a field, but another doesn't have value in same field
                                  # This case occurs very rarely
                                  if timekey == timekey2 # including the case of nil == nil
                                    if tag == tag2
                      Severity: Major
                      Found in lib/fluent/plugin/buffer.rb - About 1 hr to fix

                        Method expand has 8 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                def expand(__str_to_eval__, tag, time, record, tag_parts, tag_prefix, tag_suffix, hostname)
                        Severity: Major
                        Found in lib/fluent/plugin/filter_record_transformer.rb - About 1 hr to fix

                          Method send_request has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def send_request(uri, req)
                                res = if @reuse_connections
                                        make_request_cached(uri, req)
                                      else
                                        make_request(uri, req) { |http| http.request(req) }
                          Severity: Minor
                          Found in lib/fluent/plugin/out_http.rb - About 55 mins 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 stop_watchers has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def stop_watchers(targets_info, immediate: false, unwatched: false, remove_watcher: true)
                                targets_info.each_value { |target_info|
                                  remove_path_from_group_watcher(target_info.path)
                          
                                  if remove_watcher
                          Severity: Minor
                          Found in lib/fluent/plugin/in_tail.rb - About 55 mins 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 generate_path has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def generate_path(path_without_suffix)
                                if @append
                                  path = "#{path_without_suffix}#{@suffix}"
                                  synchronize_path(path) do
                                    yield path
                          Severity: Minor
                          Found in lib/fluent/plugin/out_secondary_file.rb - About 55 mins 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 connect_keepalive has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                                def connect_keepalive(host:, port:, hostname:, ack: nil)
                                  request_info = RequestInfo.new(:established)
                                  socket = @socket_cache.checkout_or([host, port, hostname]) do
                                    s = @connection_factory.call(host, port, hostname)
                                    request_info = RequestInfo.new(@secure ? :helo : :established) # overwrite if new connection
                          Severity: Minor
                          Found in lib/fluent/plugin/out_forward/connection_manager.rb - About 55 mins 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_float has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def parse_float(value)
                                unless value.is_a?(String) || value.is_a?(Numeric)
                                  raise TimeParseError, "value must be a string or a number: #{value}(#{value.class})"
                                end
                          
                          
                          Severity: Minor
                          Found in lib/fluent/time.rb - About 55 mins 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 open has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                                    def open(**kwargs, &block)
                                      if kwargs[:compressed] == :gzip
                                        super
                                      else
                                        super(**kwargs) do |chunk_io|
                          Severity: Minor
                          Found in lib/fluent/plugin/buffer/chunk.rb - About 55 mins 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_rfc3164_regex has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                                def parse_rfc3164_regex(text, &block)
                                  idx = 0
                                  record = {}
                          
                                  if @with_priority
                          Severity: Minor
                          Found in lib/fluent/plugin/parser_syslog.rb - About 55 mins 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 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def self.formatter(timezone = nil, format = nil)
                                if timezone.nil?
                                  return nil
                                end
                          
                          
                          Severity: Minor
                          Found in lib/fluent/timezone.rb - About 55 mins 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