fluent/fluentd

View on GitHub

Showing 664 of 664 total issues

Method write_step_by_step has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def write_step_by_step(metadata, data, format, splits_count, &block)
Severity: Minor
Found in lib/fluent/plugin/buffer.rb - About 35 mins to fix

    Method build_request has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def build_request(method, id, scope = nil, params = nil, options = nil)
    Severity: Minor
    Found in lib/fluent/counter/client.rb - About 35 mins to fix

      Method placeholder_validators has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def placeholder_validators(name, str, time_key = (@chunk_key_time && @buffer_config.timekey), tag_key = @chunk_key_tag, chunk_keys = @chunk_keys)
      Severity: Minor
      Found in lib/fluent/plugin/output.rb - About 35 mins to fix

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

              def initialize(file, file_mutex, seek, pos, inode)
        Severity: Minor
        Found in lib/fluent/plugin/in_tail/position_file.rb - About 35 mins to fix

          Method socket_create has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                def socket_create(proto, host, port, **kwargs, &block)
          Severity: Minor
          Found in lib/fluent/plugin_helper/socket.rb - About 35 mins to fix

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

                  def initialize(name, arg, attrs, elements, unused = nil)
            Severity: Minor
            Found in lib/fluent/config/element.rb - About 35 mins to fix

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

                    def cert_option_certificates_from_file(path)
                      data = File.read(path)
                      pattern = Regexp.compile('-+BEGIN CERTIFICATE-+\r?\n(?:[^-]*\r?\n)+-+END CERTIFICATE-+\r?\n?', Regexp::MULTILINE)
                      list = []
                      data.scan(pattern){|match| list << OpenSSL::X509::Certificate.new(match) }
              Severity: Minor
              Found in lib/fluent/plugin_helper/cert_option.rb and 1 other location - About 35 mins to fix
              lib/fluent/plugin_helper/socket.rb on lines 207..215

              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 36.

              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

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

                    def socket_certificates_from_file(path)
                      data = File.read(path)
                      pattern = Regexp.compile('-+BEGIN CERTIFICATE-+\r?\n(?:[^-]*\r?\n)+-+END CERTIFICATE-+\r?\n?', Regexp::MULTILINE)
                      list = []
                      data.scan(pattern) { |match| list << OpenSSL::X509::Certificate.new(match) }
              Severity: Minor
              Found in lib/fluent/plugin_helper/socket.rb and 1 other location - About 35 mins to fix
              lib/fluent/plugin_helper/cert_option.rb on lines 187..195

              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 36.

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

                  def call
                    if Fluent.windows?
                      if /^[0-9]+$/.match?(@pid_or_svcname)
                        # Use as PID
                        return call_windows_event(@command, "fluentd_#{@pid_or_svcname}")
              Severity: Minor
              Found in lib/fluent/command/ctl.rb - About 35 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 invoke has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                    def invoke(sock, ri, data)
                      @log.trace __callee__
              
                      case ri.state
                      when :helo
              Severity: Minor
              Found in lib/fluent/plugin/out_forward/handshake_protocol.rb - About 35 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 on_notify has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                      def on_notify(stat)
                        if stat.nil?
                          inode = nil
                          fsize = 0
                        else
              Severity: Minor
              Found in lib/fluent/plugin/in_tail.rb - About 35 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 make_request_cached has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def make_request_cached(uri, req)
                    id = self.connection_cache_id_for_thread
                    if id.nil?
                      @connection_cache_id_mutex.synchronize {
                        id = @connection_cache_next_id
              Severity: Minor
              Found in lib/fluent/plugin/out_http.rb - About 35 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 drop_capabilities has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def drop_capabilities(opts, target_file)
                    if drop_caps = opts[:drop_capabilities]
                      @capng.clear(:caps)
                      @capng.caps_file(target_file)
                      capabilities = drop_caps.split(/\s*,\s*/)
              Severity: Minor
              Found in lib/fluent/command/cap_ctl.rb - About 35 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 start has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                      def start
                        @thread = ::Thread.new {
                          until @flag.wait_for_set(0.5)
                            now = Time.now
                            @mutex.synchronize {
              Severity: Minor
              Found in lib/fluent/plugin/parser.rb - About 35 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 copy_license has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                def copy_license
                  # in gem_name directory
                  return unless license_name
                  puts "License: #{license_name}"
                  license_class = self.class.lookup_license(license_name)
              Severity: Minor
              Found in lib/fluent/command/plugin_generator.rb - About 35 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 select_healthy_node has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                    def select_healthy_node
                      error = nil
              
                      # Don't care about the change of @weight_array's size while looping since
                      # it's only used for determining the number of loops and it is not so important.
              Severity: Minor
              Found in lib/fluent/plugin/out_forward/load_balancer.rb - About 35 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 build_option has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                    def build_option(req)
                      qs = Hash.new { |_, _| [] }
                      # parse ?=query string
                      if req.query_string
                        qs.merge!(CGI.parse(req.query_string))
              Severity: Minor
              Found in lib/fluent/plugin/in_monitor_agent.rb - About 35 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 add_capabilities has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def add_capabilities(opts, target_file)
                    if add_caps = opts[:add_capabilities]
                      @capng.clear(:caps)
                      @capng.caps_file(target_file)
                      capabilities = add_caps.split(/\s*,\s*/)
              Severity: Minor
              Found in lib/fluent/command/cap_ctl.rb - About 35 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 commit_write has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                    def commit_write(chunk_id, delayed: @delayed_commit, secondary: false)
                      log.on_trace { log.trace "committing write operation to a chunk", chunk: dump_unique_id_hex(chunk_id), delayed: delayed }
              
                      if delayed
                        @dequeued_chunks_mutex.synchronize do
              Severity: Minor
              Found in lib/fluent/plugin/output.rb - About 35 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 configure has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                    def configure(conf)
                      super
              
                      if @json_parser == 'oj'
                        if Fluent::OjOptions.available?
              Severity: Minor
              Found in lib/fluent/plugin/formatter_json.rb - About 35 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