fluent/fluentd

View on GitHub

Showing 577 of 664 total issues

Method parse_rfc5424_regex has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def parse_rfc5424_regex(text, &block)
        idx = 0
        record = {}

        if @with_priority
Severity: Minor
Found in lib/fluent/plugin/parser_syslog.rb - About 1 hr 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 11 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(type, format = nil, localtime = nil, timezone = nil, utc = nil, force_localtime = nil, fallbacks = [])
      @parsers = []
      fallbacks.unshift(format).each do |fallback|
        next unless fallback
        case fallback
Severity: Minor
Found in lib/fluent/time.rb - About 1 hr 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_worker has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def run_worker
      Process.setproctitle("worker:#{@system_config.process_name}") if @process_name

      if @standalone_worker && @system_config.workers != 1
        raise Fluent::ConfigError, "invalid number of workers (must be 1 or unspecified) with --no-supervisor: #{@system_config.workers}"
Severity: Minor
Found in lib/fluent/supervisor.rb - About 1 hr 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_stream has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def filter_stream(tag, es)
      new_es = Fluent::MultiEventStream.new
      es.each do |time, record|
        begin
          raw_value = @accessor.call(record)
Severity: Minor
Found in lib/fluent/plugin/filter_parser.rb - About 1 hr 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 after_shutdown has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def after_shutdown
        try_rollback_all if @buffering && !@as_secondary # rollback regardless with @delayed_commit, because secondary may do it
        @secondary.after_shutdown if @secondary

        if @buffering && @buffer
Severity: Minor
Found in lib/fluent/plugin/output.rb - About 1 hr 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 11 (exceeds 5 allowed). Consider refactoring.
Open

      def configure(conf)
        super

        @regexp_parser = @parser_engine == :regexp
        @regexp = case @message_format
Severity: Minor
Found in lib/fluent/plugin/parser_syslog.rb - About 1 hr 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 11 (exceeds 5 allowed). Consider refactoring.
Open

      def configure(conf)
        if conf.has_key?('localtime') || conf.has_key?('utc')
          if conf.has_key?('localtime')
            conf['localtime'] = Fluent::Config.bool_value(conf['localtime'])
          elsif conf.has_key?('utc')
Severity: Minor
Found in lib/fluent/time.rb - About 1 hr 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 cancel_source_only has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def cancel_source_only
      if ENV.key?("FLUENT_RUNNING_IN_PARALLEL_WITH_OLD")
        if config[:rpc_endpoint]
          begin
            @rpc_endpoint = config[:rpc_endpoint]
Severity: Minor
Found in lib/fluent/supervisor.rb - About 1 hr 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 main_process has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def main_process(&block)
      if @system_config.process_name
        if @system_config.workers > 1
          Process.setproctitle("worker:#{@system_config.process_name}#{ENV['SERVERENGINE_WORKER_ID']}")
        else
Severity: Minor
Found in lib/fluent/supervisor.rb - About 1 hr 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_stream_simple has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def handle_stream_simple(tag, es, enqueue: false)
        if @overrides_emit
          current_emit_count = @emit_count_metrics.get
          size = es.size
          key = data = nil
Severity: Minor
Found in lib/fluent/compat/output.rb - About 1 hr 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 has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def self.build(root_agent)
      log_event_router = nil

      begin
        log_event_agent = root_agent.find_label(Fluent::Log::LOG_EVENT_LABEL)
Severity: Minor
Found in lib/fluent/fluent_log_event_router.rb - About 1 hr 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 11 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize
      super
      # to simulate implicit 'attr_accessor' by config_param / config_section and its value by config_set_default
      proxy = self.class.merged_configure_proxy
      proxy.params.each_key do |name|
Severity: Minor
Found in lib/fluent/configurable.rb - About 1 hr 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 11 (exceeds 5 allowed). Consider refactoring.
Open

        def initialize(title, wait, timeout, forever, max_steps, randomize, randomize_width, secondary, secondary_threshold)
          @title = title

          @start = current_time
          @steps = 0
Severity: Minor
Found in lib/fluent/plugin_helper/retry_state.rb - About 1 hr 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 event_emitter_router has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def event_emitter_router(label_name)
        if label_name
          if label_name == "@ROOT"
            Engine.root_agent.event_router
          else
Severity: Minor
Found in lib/fluent/plugin_helper/event_emitter.rb - About 1 hr 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 option_value_type! has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def option_value_type!(name, opts, key, klass=nil, type: nil)
        if opts.has_key?(key)
          if klass && !opts[key].is_a?(klass)
            raise ArgumentError, "#{name}: #{key} must be a #{klass}, but #{opts[key].class}"
          end
Severity: Minor
Found in lib/fluent/config/configure_proxy.rb - About 1 hr 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 reload_config has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def reload_config(conf, supervisor: false)
      @root_agent_mutex.synchronize do
        # configure first to reduce down time while restarting
        new_agent = RootAgent.new(log: log, system_config: @system_config)
        ret = Fluent::StaticConfigAnalysis.call(conf, workers: system_config.workers)
Severity: Minor
Found in lib/fluent/engine.rb - About 1 hr 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 eval_include has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def eval_include(attrs, elems, uri)
        # replace space(s)(' ') with '+' to prevent invalid uri due to space(s).
        # See: https://github.com/fluent/fluentd/pull/2780#issuecomment-576081212
        u = URI.parse(uri.tr(' ', '+'))
        if u.scheme == 'file' || (!u.scheme.nil? && u.scheme.length == 1) || u.path == uri.tr(' ', '+') # file path
Severity: Minor
Found in lib/fluent/config/v1_parser.rb - About 1 hr 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 31 lines of code (exceeds 25 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 1 hr to fix

    Method cmp_variables has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def cmp_variables(v1, v2)
              if v1.nil? && v2.nil?
                return 0
              elsif v1.nil? # v2 is non-nil
                return -1
    Severity: Minor
    Found in lib/fluent/plugin/buffer.rb - About 1 hr to fix

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

          def configure(supervisor: false)
            setup_global_logger(supervisor: supervisor)
      
            if @show_plugin_config
              show_plugin_config
      Severity: Minor
      Found in lib/fluent/supervisor.rb - About 1 hr to fix
        Severity
        Category
        Status
        Source
        Language