fluent/fluentd

View on GitHub

Showing 577 of 664 total issues

Method write_once has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def write_once(metadata, data, format: nil, size: nil, &block)
        return if data.empty?

        stored = false
        adding_bytesize = nil
Severity: Minor
Found in lib/fluent/plugin/buffer.rb - About 1 hr to fix

    Method flush_thread_run has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def flush_thread_run(state)
            flush_thread_interval = @buffer_config.flush_thread_interval
    
            state.next_clock = Fluent::Clock.now + flush_thread_interval
    
    
    Severity: Minor
    Found in lib/fluent/plugin/output.rb - About 1 hr to fix

      Method on_rotate has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def on_rotate(stat)
              if @io_handler.nil?
                if stat
                  # first time
                  fsize = stat.size
      Severity: Minor
      Found in lib/fluent/plugin/in_tail.rb - About 1 hr to fix

        Method resume has 45 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.rb - About 1 hr to fix

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

                def configure(conf)
                  super
          
                  @variable_store = Fluent::VariableStore.fetch_or_build(:buf_file)
          
          
          Severity: Minor
          Found in lib/fluent/plugin/buf_file.rb - About 1 hr to fix

            Method get_monitor_info has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def get_monitor_info(pe, opts={})
                  obj = {}
            
                  # Common plugin information
                  obj['plugin_id'] = pe.plugin_id
            Severity: Minor
            Found in lib/fluent/plugin/in_monitor_agent.rb - About 1 hr to fix

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

                Method search has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def search(type)
                      # search from additional plugin directories
                      if @dir_search_prefix
                        path = "#{@dir_search_prefix}#{type}"
                        files = @paths.filter_map { |lp|
                Severity: Minor
                Found in lib/fluent/registry.rb - About 1 hr to fix

                  Method dump_section_markdown has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def dump_section_markdown(base_section, level = 0)
                      dumped = ""
                      if base_section[:section]
                        sections = []
                        params = base_section
                  Severity: Minor
                  Found in lib/fluent/command/plugin_config_formatter.rb - About 1 hr to fix

                    Method configure has 44 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 rebuild_weight_array has a Cognitive Complexity of 14 (exceeds 5 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

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

                            def read_ack_from_sock(sock)
                              begin
                                raw_data = sock.instance_of?(Fluent::PluginHelper::Socket::WrappedSocket::TLS) ? sock.readpartial(@read_length) : sock.recv(@read_length)
                              rescue Errno::ECONNRESET, EOFError # ECONNRESET for #recv, #EOFError for #readpartial
                                raw_data = ''
                      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 parse has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def parse(text)
                              m = REGEXP.match(text)
                              unless m
                                yield nil, nil
                                return
                      Severity: Minor
                      Found in lib/fluent/plugin/parser_apache2.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 check_ping has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def check_ping(message, remote_addr, user_auth_salt, nonce)
                            log.debug "checking ping"
                            # ['PING', self_hostname, shared_key_salt, sha512_hex(shared_key_salt + self_hostname + nonce + shared_key), username || '', sha512_hex(auth_salt + username + password) || '']
                            unless message.size == 6 && message[0] == 'PING'
                              return false, 'invalid ping message'
                      Severity: Minor
                      Found in lib/fluent/plugin/in_forward.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_write has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def try_write(chunk)
                            tmpfile = nil
                            prog = if chunk.respond_to?(:path)
                                     "#{@command} #{chunk.path}"
                                   else
                      Severity: Minor
                      Found in lib/fluent/plugin/out_exec.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 find has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def find(tag)
                            pipeline = nil
                            @match_rules.each do |rule|
                              if rule.match?(tag)
                                if rule.collector.is_a?(Plugin::Filter)
                      Severity: Minor
                      Found in lib/fluent/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 socket_option_set has a Cognitive Complexity of 14 (exceeds 5 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

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

                              def values_map(values)
                                record = Hash[keys.zip(values.map { |value| convert_value_to_nil(value) })]
                      
                                if @time_key
                                  value = @keep_time_key ? record[@time_key] : record.delete(@time_key)
                      Severity: Minor
                      Found in lib/fluent/compat/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 run_configure has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def run_configure(conf, dry_run: false)
                            configure(conf)
                            conf.check_not_fetched do |key, e|
                              parent_name, plugin_name = e.unused_in
                              message = if parent_name && plugin_name
                      Severity: Minor
                      Found in lib/fluent/engine.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 initialize has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def initialize(logger, opts={})
                            # When ServerEngine changes the logger.level, the Fluentd logger level should also change.
                            # So overwrites logger.level= below.
                            # However, currently Fluentd doesn't use the ServerEngine's reloading feature,
                            # so maybe we don't need this overwriting anymore.
                      Severity: Minor
                      Found in lib/fluent/log.rb - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language