fluent/fluentd

View on GitHub

Showing 577 of 664 total issues

Method start has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def start
      super

      @children_mutex = Mutex.new
      @children = []
Severity: Major
Found in lib/fluent/plugin/out_exec_filter.rb - About 2 hrs to fix

    Method shutdown has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def shutdown(kind_or_agent_list: nil)
          # 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: Major
    Found in lib/fluent/root_agent.rb - About 2 hrs to fix

      Method dump_section_markdown has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

        def dump_section_markdown(base_section, level = 0)
          dumped = ""
          if base_section[:section]
            sections = []
            params = base_section
      Severity: Minor
      Found in lib/fluent/command/plugin_config_formatter.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 dump_section_txt has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

        def dump_section_txt(base_section, level = 0)
          dumped = ""
          indent = " " * level
          if base_section[:section]
            sections = []
      Severity: Minor
      Found in lib/fluent/command/plugin_config_formatter.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 handle_connection has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def handle_connection(conn)
            send_data = ->(serializer, data){ conn.write serializer.call(data) }
      
            log.trace "connected fluent socket", addr: conn.remote_addr, port: conn.remote_port
            state = :established
      Severity: Minor
      Found in lib/fluent/plugin/in_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 <=> has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

              def <=>(o)
                timekey2 = o.timekey
                tag2 = o.tag
                variables2 = o.variables
                if (!!timekey ^ !!timekey2) || (!!tag ^ !!tag2) || (!!variables ^ !!variables2)
      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 refresh_watchers has a Cognitive Complexity of 17 (exceeds 5 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 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 start has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

            def start
              super
      
              if @buffering.nil?
                @buffering = prefer_buffered_processing
      Severity: Minor
      Found in lib/fluent/plugin/output.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 initialize has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize(format = nil, localtime = true, timezone = nil)
            if format.nil? && (timezone || !localtime)
              raise Fluent::ConfigError, "specifying timezone requires time format"
            end
      
      
      Severity: Minor
      Found in lib/fluent/time.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 hash_value has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.hash_value(val, opts = {}, name = nil)
            return nil if val.nil?
      
            param = if val.is_a?(String)
                      val.start_with?('{') ? JSON.parse(val) : Hash[val.strip.split(/\s*,\s*/).map{|v| v.split(':', 2)}]
      Severity: Minor
      Found in lib/fluent/config/types.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 check_unused_section has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

            def self.check_unused_section(proxy, conf, plugin_class)
              elems = conf.respond_to?(:elements) ? conf.elements : []
              elems.each { |e|
                next if plugin_class.nil? && Fluent::Config::V1Parser::ELEM_SYMBOLS.include?(e.name) # skip pre-defined non-plugin elements because it doesn't have proxy section
                next if e.unused_in && e.unused_in.empty? # the section is used at least once
      Severity: Minor
      Found in lib/fluent/config/section.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 close has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

            def close
              while true
                pids = @_child_process_mutex.synchronize{ @_child_process_processes.keys }
                break if pids.size < 1
      
      
      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 server_create has 56 lines of code (exceeds 25 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: Major
      Found in lib/fluent/plugin_helper/server.rb - About 2 hrs to fix

        File out_exec_filter.rb has 259 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'fluent/plugin/output'
        require 'fluent/env'
        require 'fluent/config/error'
        
        require 'yajl'
        Severity: Minor
        Found in lib/fluent/plugin/out_exec_filter.rb - About 2 hrs to fix

          Class EventTime has 21 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class EventTime
              TYPE = 0
              FORMATTER = Strftime.new('%Y-%m-%d %H:%M:%S.%N %z')
          
              def initialize(sec, nsec = 0)
          Severity: Minor
          Found in lib/fluent/time.rb - About 2 hrs to fix

            Class EngineClass has 21 methods (exceeds 20 allowed). Consider refactoring.
            Open

              class EngineClass
                # For compat. remove it in fluentd v2
                include Fluent::MessagePackFactory::Mixin
            
                def initialize
            Severity: Minor
            Found in lib/fluent/engine.rb - About 2 hrs to fix

              Method enqueue_thread_run has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def enqueue_thread_run
                      value_for_interval = nil
                      if @flush_mode == :interval
                        value_for_interval = @buffer_config.flush_interval
                      end
              Severity: Major
              Found in lib/fluent/plugin/output.rb - About 2 hrs to fix

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

                      def configure(conf)
                        super
                
                        @on_memory = false
                        if @path
                Severity: Major
                Found in lib/fluent/plugin/storage_local.rb - About 2 hrs to fix

                  File filter_record_transformer.rb has 255 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require 'socket'
                  require 'json'
                  require 'ostruct'
                  
                  require 'fluent/plugin/filter'
                  Severity: Minor
                  Found in lib/fluent/plugin/filter_record_transformer.rb - About 2 hrs to fix

                    Method process has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def process(tag, es)
                          unless es.repeatable?
                            m = Fluent::MultiEventStream.new
                            es.each {|time,record|
                              m.add(time, record)
                    Severity: Minor
                    Found in lib/fluent/plugin/out_copy.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

                    Severity
                    Category
                    Status
                    Source
                    Language