fluent/fluentd

View on GitHub

Showing 653 of 653 total issues

Method socket_create_tls has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
Open

      def socket_create_tls(
          host, port,
          version: Fluent::TLS::DEFAULT_VERSION, min_version: nil, max_version: nil, ciphers: Fluent::TLS::CIPHERS_DEFAULT, insecure: false, verify_fqdn: true, fqdn: nil,
          enable_system_cert_store: true, allow_self_signed_cert: false, cert_paths: nil,
          cert_path: nil, private_key_path: nil, private_key_passphrase: nil,
Severity: Minor
Found in lib/fluent/plugin_helper/socket.rb - About 7 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 configure has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
Open

    def configure(conf)
      super

      regexp_and_conditions = {}
      regexp_or_conditions = {}
Severity: Minor
Found in lib/fluent/plugin/filter_grep.rb - About 7 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 write_once has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
Open

      def write_once(metadata, data, format: nil, size: nil, &block)
        return if data.empty?

        stored = false
        adding_bytesize = nil
Severity: Minor
Found in lib/fluent/plugin/buffer.rb - About 7 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 a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
Open

    def on_message(msg, chunk_size, conn)
      if msg.nil?
        # for future TCP heartbeat_request
        return
      end
Severity: Minor
Found in lib/fluent/plugin/in_forward.rb - About 7 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 write has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
Open

      def write(metadata_and_data, format: nil, size: nil, enqueue: false)
        return if metadata_and_data.size < 1
        raise BufferOverflowError, "buffer space has too many data" unless storable?

        log.on_trace { log.trace "writing events into buffer", instance: self.object_id, metadata_size: metadata_and_data.size }
Severity: Minor
Found in lib/fluent/plugin/buffer.rb - About 7 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

Class Log has 47 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Log
    module TTYColor
      RESET   = "\033]R"
      CRE     = "\033[K"
      CLEAR   = "\033c"
Severity: Minor
Found in lib/fluent/log.rb - About 6 hrs to fix

    Method configure has a Cognitive Complexity of 42 (exceeds 5 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 6 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 41 (exceeds 5 allowed). Consider refactoring.
    Open

        def shutdown # Fluentd's shutdown sequence is stop, before_shutdown, shutdown, after_shutdown, close, terminate for plugins
          # These method callers does `rescue Exception` to call methods of shutdown sequence as far as possible
          # if plugin methods does something like infinite recursive call, `exit`, unregistering signal handlers or others.
          # Plugins should be separated and be in sandbox to protect data in each plugins/buffers.
    
    
    Severity: Minor
    Found in lib/fluent/root_agent.rb - About 6 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 configure has 149 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def configure(conf)
            unless implement?(:synchronous) || implement?(:buffered) || implement?(:delayed_commit)
              raise "BUG: output plugin must implement some methods. see developer documents."
            end
    
    
    Severity: Major
    Found in lib/fluent/plugin/output.rb - About 5 hrs to fix

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

            def configure(conf)
              super
      
              @on_memory = false
              if @path
      Severity: Minor
      Found in lib/fluent/plugin/storage_local.rb - About 5 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 server_create has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
      Open

            def server_create(title, port, proto: nil, bind: '0.0.0.0', shared: true, socket: nil, backlog: nil, tls_options: nil, max_bytes: nil, flags: 0, **socket_options, &callback)
              proto ||= (@transport_config && @transport_config.protocol == :tls) ? :tls : :tcp
      
              raise ArgumentError, "BUG: title must be a symbol" unless title && title.is_a?(Symbol)
              raise ArgumentError, "BUG: port must be an integer" unless port && port.is_a?(Integer)
      Severity: Minor
      Found in lib/fluent/plugin_helper/server.rb - About 5 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 filter_with_time has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
      Open

          def filter_with_time(tag, time, record)
            raw_value = @accessor.call(record)
            if raw_value.nil?
              if @emit_invalid_record_to_error
                router.emit_error_event(tag, time, record, ArgumentError.new("#{@key_name} does not exist"))
      Severity: Minor
      Found in lib/fluent/plugin/filter_parser.rb - About 5 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

      File parser_syslog.rb has 404 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'fluent/plugin/parser'
      
      require 'fluent/time'
      
      module Fluent
      Severity: Minor
      Found in lib/fluent/plugin/parser_syslog.rb - About 5 hrs to fix

        Class Buffer has 42 methods (exceeds 20 allowed). Consider refactoring.
        Open

            class Buffer < Base
              include OwnedByMixin
              include UniqueId::Mixin
              include PluginId
              include MonitorMixin
        Severity: Minor
        Found in lib/fluent/plugin/buffer.rb - About 5 hrs to fix

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

              def configure(conf)
                compat_parameters_convert(conf, :formatter, :buffer, :inject, default_chunk_key: "time")
          
                configured_time_slice_format = conf['time_slice_format']
          
          
          Severity: Minor
          Found in lib/fluent/plugin/out_file.rb - About 5 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

          File time.rb has 395 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'time'
          require 'msgpack'
          require 'strptime'
          require 'fluent/timezone'
          require 'fluent/configurable'
          Severity: Minor
          Found in lib/fluent/time.rb - About 5 hrs to fix

            Method message_handler has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
            Open

                def message_handler(data, sock)
                  pri = nil
                  text = data
                  unless @parser_parse_priority
                    m = SYSLOG_REGEXP.match(data)
            Severity: Minor
            Found in lib/fluent/plugin/in_syslog.rb - About 5 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 build_type_converters has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
            Open

                  def build_type_converters(types)
                    return nil unless types
            
                    converters = {}
            
            
            Severity: Minor
            Found in lib/fluent/plugin/parser.rb - About 5 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

            File in_forward.rb has 382 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require 'fluent/plugin/input'
            require 'fluent/msgpack_factory'
            require 'yajl'
            require 'digest'
            require 'securerandom'
            Severity: Minor
            Found in lib/fluent/plugin/in_forward.rb - About 5 hrs to fix

              Method on_rotate has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
              Open

                    def on_rotate(stat)
                      if @io_handler.nil?
                        if stat
                          # first time
                          fsize = stat.size
              Severity: Minor
              Found in lib/fluent/plugin/in_tail.rb - About 5 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

              Severity
              Category
              Status
              Source
              Language