fluent/fluentd

View on GitHub

Showing 664 of 664 total issues

Method configure has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def configure(conf)
      exec_filter_compat_parameters_convert!(conf)
      compat_parameters_convert(conf, :buffer)

      if inject_section = conf.elements('inject').first
Severity: Minor
Found in lib/fluent/plugin/out_exec_filter.rb - About 2 hrs 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_supervisor has a Cognitive Complexity of 19 (exceeds 5 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 2 hrs 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 shutdown has a Cognitive Complexity of 19 (exceeds 5 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 2 hrs 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 merge has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

      def merge(other) # self is base class, other is subclass
        return merge_for_finalized(other) if self.final?

        [:param_name, :required, :multi, :alias, :configured_in_section].each do |prohibited_name|
          if overwrite?(other, prohibited_name)
Severity: Minor
Found in lib/fluent/config/configure_proxy.rb - About 2 hrs 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 on_message has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def on_message(msg, chunk_size, conn)
      if msg.nil?
        # for future TCP heartbeat_request
        return
      end
Severity: Major
Found in lib/fluent/plugin/in_forward.rb - About 2 hrs to fix

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

        def initialize(pat)
          if pat.start_with?('/')
            if pat.end_with?('/')
              @regex = Regexp.new("\\A"+pat[1..-2]+"\\Z")
              return
    Severity: Major
    Found in lib/fluent/match.rb - About 2 hrs to fix

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

          def configure(conf)
            super
      
            regexp_and_conditions = {}
            regexp_or_conditions = {}
      Severity: Major
      Found in lib/fluent/plugin/filter_grep.rb - About 2 hrs to fix

        Class Supervisor has 23 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class Supervisor
            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 2 hrs to fix

          Class Element has 23 methods (exceeds 20 allowed). Consider refactoring.
          Open

              class Element < Hash
                def initialize(name, arg, attrs, elements, unused = nil)
                  @name = name
                  @arg = arg
                  @elements = elements
          Severity: Minor
          Found in lib/fluent/config/element.rb - About 2 hrs to fix

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

                  def configure(conf)
                    super
            
                    @variable_store = Fluent::VariableStore.fetch_or_build(:buf_file_single)
            
            
            Severity: Major
            Found in lib/fluent/plugin/buf_file_single.rb - About 2 hrs to fix

              Method extract_placeholders has 62 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def extract_placeholders(str, chunk)
                      metadata = if chunk.is_a?(Fluent::Plugin::Buffer::Chunk)
                                   chunk_passed = true
                                   chunk.metadata
                                 else
              Severity: Major
              Found in lib/fluent/plugin/output.rb - About 2 hrs to fix

                Method enqueue_all has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                      def enqueue_all(force_enqueue = false)
                        log.on_trace { log.trace "enqueueing all chunks in buffer", instance: self.object_id }
                        update_timekeys if @enable_update_timekeys
                
                        if block_given?
                Severity: Minor
                Found in lib/fluent/plugin/buffer.rb - About 2 hrs 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 establish_connection has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                      def establish_connection(sock, ri)
                        while ri.state != :established
                          begin
                            # TODO: On Ruby 2.2 or earlier, read_nonblock doesn't work expectedly.
                            # We need rewrite around here using new socket/server plugin helper.
                Severity: Minor
                Found in lib/fluent/plugin/out_forward.rb - About 2 hrs 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_once has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                      def run_once
                        @mutex.synchronize do
                          last_cleanup_at = (Time.now - CLEANUP_INTERVAL).to_i
                          @mutex_hash.each do |(key, mutex)|
                            v = @store.get(key, raw: true)
                Severity: Minor
                Found in lib/fluent/counter/mutex_hash.rb - About 2 hrs 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 compat_parameters_inject has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                      def compat_parameters_inject(conf)
                        return unless conf.elements('inject').empty?
                        return if INJECT_PARAMS.keys.all?{|k| !conf.has_key?(k) }
                
                        # TODO: warn obsolete parameters if these are deprecated
                Severity: Minor
                Found in lib/fluent/plugin_helper/compat_parameters.rb - About 2 hrs 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 merge_for_finalized has a Cognitive Complexity of 18 (exceeds 5 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 2 hrs 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 expand_paths has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def expand_paths
                      date = Fluent::EventTime.now
                      paths = []
                      @paths.each { |path|
                        path = if @path_timezone
                Severity: Major
                Found in lib/fluent/plugin/in_tail.rb - About 2 hrs to fix

                  File out_file.rb has 265 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require 'fileutils'
                  require 'zlib'
                  require 'time'
                  
                  require 'fluent/plugin/output'
                  Severity: Minor
                  Found in lib/fluent/plugin/out_file.rb - About 2 hrs to fix

                    File compat_parameters.rb has 265 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    require 'fluent/config/types'
                    require 'fluent/config/element'
                    
                    module Fluent
                      module PluginHelper
                    Severity: Minor
                    Found in lib/fluent/plugin_helper/compat_parameters.rb - About 2 hrs to fix

                      File plugin_config_formatter.rb has 264 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      require "erb"
                      require "optparse"
                      require "pathname"
                      require "fluent/plugin"
                      require "fluent/env"
                      Severity: Minor
                      Found in lib/fluent/command/plugin_config_formatter.rb - About 2 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language