fluent/fluentd

View on GitHub

Showing 577 of 664 total issues

Method scan_json has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def scan_json(is_array)
        result = nil
        # Yajl does not raise ParseError for incomplete json string, like '[1', '{"h"', '{"h":' or '{"h1":1'
        # This is the reason to use JSON module.

Severity: Minor
Found in lib/fluent/config/literal_parser.rb - About 1 hr to fix

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

        def configure(conf)
          super
    
          @connection_cache = Array.new(actual_flush_thread_count, ConnectionCache.new("", nil)) if @reuse_connections
    
    
    Severity: Minor
    Found in lib/fluent/plugin/out_http.rb - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

            if MIN_MAX_AVAILABLE
              case
              when min_version.nil? && max_version.nil?
                min_version = METHODS_MAP[version] || version
                max_version = METHODS_MAP[version] || version
      Severity: Critical
      Found in lib/fluent/tls.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 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 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 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 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 before_run has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def before_run
                            @fluentd_conf = config[:fluentd_conf]
                            @rpc_endpoint = nil
                            @rpc_server = nil
                            @counter = nil
                      Severity: Minor
                      Found in lib/fluent/supervisor.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 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 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 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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language