fluent/fluentd

View on GitHub

Showing 664 of 664 total issues

Method write has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def write(chunk)
      path = extract_placeholders(@path_template, chunk)
      FileUtils.mkdir_p File.dirname(path), mode: @dir_perm

      writer = case
Severity: Minor
Found in lib/fluent/plugin/out_file.rb - About 1 hr to fix

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

      Method gen_copy_proc has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def gen_copy_proc
            @copy_mode = :shallow if @deep_copy
      
            case @copy_mode
            when :no_copy
      Severity: Minor
      Found in lib/fluent/plugin/out_copy.rb - About 1 hr to fix

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

            def configure(conf)
              super
        
              map = {}
              # <record></record> directive
        Severity: Minor
        Found in lib/fluent/plugin/filter_record_transformer.rb - About 1 hr to fix

          Method install_main_process_command_handlers has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def install_main_process_command_handlers
                command_pipe = $stdin.dup
                $stdin.reopen(File::NULL, "rb")
                command_pipe.binmode
                command_pipe.sync = true
          Severity: Minor
          Found in lib/fluent/supervisor.rb - About 1 hr to fix

            Method eval_include has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def eval_include(attrs, elems, uri)
                    # replace space(s)(' ') with '+' to prevent invalid uri due to space(s).
                    # See: https://github.com/fluent/fluentd/pull/2780#issuecomment-576081212
                    u = URI.parse(uri.tr(' ', '+'))
                    if u.scheme == 'file' || (!u.scheme.nil? && u.scheme.length == 1) || u.path == uri.tr(' ', '+') # file path
            Severity: Minor
            Found in lib/fluent/config/v1_parser.rb - About 1 hr to fix

              Method parse_dot_array_op has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def self.parse_dot_array_op(key, param)
                        start = key.index('[')
                        result = if start.zero?
                                   []
                                 else
              Severity: Minor
              Found in lib/fluent/plugin_helper/record_accessor.rb - About 1 hr to fix

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                      case
                      when @parser.implement?(:parse_io)
                        @parser.parse_io(io, &method(:on_record))
                      when @parser.implement?(:parse_partial_data)
                        until io.eof?
                Severity: Major
                Found in lib/fluent/plugin/out_exec_filter.rb and 1 other location - About 1 hr to fix
                lib/fluent/plugin/in_exec.rb on lines 96..108

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 52.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                      case
                      when @parser.implement?(:parse_io)
                        @parser.parse_io(io, &method(:on_record))
                      when @parser.implement?(:parse_partial_data)
                        until io.eof?
                Severity: Major
                Found in lib/fluent/plugin/in_exec.rb and 1 other location - About 1 hr to fix
                lib/fluent/plugin/out_exec_filter.rb on lines 288..300

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 52.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Method initialize has 9 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                      def initialize(target_info, pe, log, read_from_head, follow_inodes, update_watcher, line_buffer_timer_flusher, io_handler_build, metrics)
                Severity: Major
                Found in lib/fluent/plugin/in_tail.rb - About 1 hr to fix

                  Method initialize has 9 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          def initialize(title, wait, timeout, forever, max_steps, randomize, randomize_width, secondary, secondary_threshold)
                  Severity: Major
                  Found in lib/fluent/plugin_helper/retry_state.rb - About 1 hr to fix

                    Method initialize has 9 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                            def initialize(title, wait, timeout, forever, max_steps, randomize, randomize_width, secondary, secondary_threshold)
                    Severity: Major
                    Found in lib/fluent/plugin_helper/retry_state.rb - About 1 hr to fix

                      Method update_watcher has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def update_watcher(tail_watcher, pe, new_inode)
                            # TODO we should use another callback for this.
                            # To supress impact to existing logics, limit the case to `@follow_inodes`.
                            # We may not need `@follow_inodes` condition.
                            if @follow_inodes && new_inode.nil?
                      Severity: Minor
                      Found in lib/fluent/plugin/in_tail.rb - About 1 hr to fix

                        Method refresh_watchers has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def refresh_watchers
                              target_paths_hash = expand_paths
                              existence_paths_hash = existence_path
                        
                              log.debug {
                        Severity: Minor
                        Found in lib/fluent/plugin/in_tail.rb - About 1 hr to fix

                          Method read_messages has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              def read_messages(conn, &block)
                                feeder = nil
                                serializer = nil
                                bytes = 0
                                conn.data do |data|
                          Severity: Minor
                          Found in lib/fluent/plugin/in_forward.rb - About 1 hr to fix

                            Method supervise has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def supervise
                                  Process.setproctitle("supervisor:#{@system_config.process_name}") if @system_config.process_name
                                  $log.info "starting fluentd-#{Fluent::VERSION}", pid: Process.pid, ruby: RUBY_VERSION
                            
                                  fluentd_spawn_cmd = build_spawn_command
                            Severity: Minor
                            Found in lib/fluent/supervisor.rb - About 1 hr to fix

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

                                      def initialize(title, wait, timeout, forever, max_steps, randomize, randomize_width, secondary, secondary_threshold)
                                        @title = title
                              
                                        @start = current_time
                                        @steps = 0
                              Severity: Minor
                              Found in lib/fluent/plugin_helper/retry_state.rb - About 1 hr to fix

                                Method default_options has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    def self.default_options
                                      {
                                        config_path: Fluent::DEFAULT_CONFIG_PATH,
                                        plugin_dirs: [Fluent::DEFAULT_PLUGIN_DIR],
                                        log_level: Fluent::Log::LEVEL_INFO,
                                Severity: Minor
                                Found in lib/fluent/supervisor.rb - About 1 hr to fix

                                  Method mount_proc has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                        def mount_proc(path, &block)
                                          @server.mount_proc(path) { |req, res|
                                            begin
                                              code, header, response = block.call(req, res)
                                            rescue => e
                                  Severity: Minor
                                  Found in lib/fluent/rpc.rb - About 1 hr to fix

                                    Method configure has 28 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
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language