fluent/fluentd

View on GitHub

Showing 566 of 655 total issues

Method add_match has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def add_match(type, pattern, conf)
      log_type = conf.for_this_worker? ? :default : :worker0
      log.info log_type, "adding match#{@context.nil? ? '' : " in #{@context}"}", pattern: pattern, type: type

      output = Plugin.new_output(type)
Severity: Minor
Found in lib/fluent/agent.rb - About 55 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_spawn_command has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def build_spawn_command
      if ENV['TEST_RUBY_PATH']
        fluentd_spawn_cmd = [ENV['TEST_RUBY_PATH']]
      else
        fluentd_spawn_cmd = [ServerEngine.ruby_bin_path]
Severity: Minor
Found in lib/fluent/supervisor.rb - About 55 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 warn has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def warn(*args, &block)
      return if @level > LEVEL_WARN
      type = log_type(args)
      return if skipped_type?(type)
      args << block.call if block
Severity: Minor
Found in lib/fluent/log.rb - About 55 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 set_version_to_context has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def set_version_to_context(ctx, version, min_version, max_version)
      if MIN_MAX_AVAILABLE
        case
        when min_version.nil? && max_version.nil?
          min_version = METHODS_MAP[version] || version
Severity: Minor
Found in lib/fluent/tls.rb - About 55 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 mount_proc has a Cognitive Complexity of 9 (exceeds 5 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 55 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 array_value has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def self.array_value(val, opts = {}, name = nil)
      return nil if val.nil?

      param = if val.is_a?(String)
                val.start_with?('[') ? JSON.parse(val) : val.strip.split(/\s*,\s*/)
Severity: Minor
Found in lib/fluent/config/types.rb - About 55 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 process_include has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def process_include(attrs, elems, uri, allow_include = true)
        u = URI.parse(uri)
        if u.scheme == 'file' || u.path == uri  # file path
          path = u.path
          if path[0] != ?/
Severity: Minor
Found in lib/fluent/config/parser.rb - About 55 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 parse has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def self.parse(path)
        context = Kernel.binding

        unless context.respond_to?(:use_nil)
          context.define_singleton_method(:use_nil) do
Severity: Minor
Found in lib/fluent/config/yaml_parser.rb - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

      def configure(conf)
        super

        if @extract_config
          @_extract_tag_key = @extract_config.tag_key
Severity: Minor
Found in lib/fluent/plugin_helper/extract.rb - About 55 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 initialize has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def initialize(type, format = nil, localtime = nil, timezone = nil, utc = nil, force_localtime = nil, fallbacks = [])
Severity: Major
Found in lib/fluent/time.rb - About 50 mins to fix

    Method parse_plain has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def parse_plain(re, time, text, idx, record, capture_list, &block)
    Severity: Major
    Found in lib/fluent/plugin/parser_syslog.rb - About 50 mins to fix

      Method server_create_for_tls_connection has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def server_create_for_tls_connection(shared, bind, port, conf, backlog, socket_option_setter, &block)
      Severity: Major
      Found in lib/fluent/plugin_helper/server.rb - About 50 mins to fix

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

                  def initialize(sock, max_bytes, flags, close_socket, log, under_plugin_development, &callback)
        Severity: Major
        Found in lib/fluent/plugin_helper/server.rb - About 50 mins to fix

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

                    def initialize(sock, context, socket_option_setter, close_callback, log, under_plugin_development, connect_callback)
          Severity: Major
          Found in lib/fluent/plugin_helper/server.rb - About 50 mins to fix

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

                    def initialize(title, interval, repeat, log, checker, detacher, &callback)
            Severity: Major
            Found in lib/fluent/plugin_helper/timer.rb - About 50 mins to fix

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

                  def configure(conf)
                    super
              
                    unless @as_secondary
                      raise Fluent::ConfigError, "This plugin can only be used in the <secondary> section"
              Severity: Minor
              Found in lib/fluent/plugin/out_secondary_file.rb - About 45 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

              Avoid deeply nested control flow statements.
              Open

                                  @ignore_list << p if @ignore_repeated_permission_error
              Severity: Major
              Found in lib/fluent/plugin/in_tail.rb - About 45 mins to fix

                Method read_messages has a Cognitive Complexity of 8 (exceeds 5 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 45 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

                Avoid deeply nested control flow statements.
                Open

                                  if adding_bytes > @chunk_limit_size
                                    errors << "concatenated/appended a #{adding_bytes} bytes record (nth: #{writing_splits_index}) is larger than buffer chunk limit size (#{@chunk_limit_size})"
                                    writing_splits_index += 1
                                    next
                                  else
                Severity: Major
                Found in lib/fluent/plugin/buffer.rb - About 45 mins to fix

                  Method check_pong has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def check_pong(ri, message)
                          @log.debug('checking pong')
                          # ['PONG', bool(authentication result), 'reason if authentication failed',
                          #  self_hostname, sha512\_hex(salt + self_hostname + nonce + sharedkey)]
                          unless message.size == 5 && message[0] == 'PONG'
                  Severity: Minor
                  Found in lib/fluent/plugin/out_forward/handshake_protocol.rb - About 45 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