fluent/fluentd

View on GitHub

Showing 565 of 654 total issues

Method reload_config has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def reload_config(conf, supervisor: false)
      # 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 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 scan_nonquoted_string has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def scan_nonquoted_string(boundary_charset = LINE_END)
        charset = /(?!#{boundary_charset})./

        string = []
        while true
Severity: Minor
Found in lib/fluent/config/literal_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 scan_single_quoted_string has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def scan_single_quoted_string
        string = []
        while true
          if skip(/\'/)
            return string.join
Severity: Minor
Found in lib/fluent/config/literal_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 revive_hash has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

          def revive_hash(hash, o)
            super(hash, o).tap do |r|
              if r[SHOVEL].is_a?(Hash)
                h2 = {}
                r.each do |k, v|
Severity: Minor
Found in lib/fluent/config/yaml_parser/loader.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 regexp_value has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def self.regexp_value(str, opts = {}, name = nil)
      return nil unless str

      return Regexp.compile(str) unless str.start_with?("/")
      right_slash_position = str.rindex("/")
Severity: Minor
Found in lib/fluent/config/types.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 bool_value has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def self.bool_value(str, opts = {}, name = nil)
      return nil if str.nil?

      case str.to_s
      when 'true', 'yes'
Severity: Minor
Found in lib/fluent/config/types.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 delete_nest has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def delete_nest(r)
          if target = r.dig(*@dig_keys)
            if target.is_a?(Array)
              target.delete_at(@last_key)
            else
Severity: Minor
Found in lib/fluent/plugin_helper/record_accessor.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 run_once has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def run_once
          # Don't care race in this loop intentionally
          s = @queue.size

          if s == 0
Severity: Minor
Found in lib/fluent/plugin_helper/service_discovery/manager.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 handle_message has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def handle_message(msg)
          service = msg.service

          case msg.type
          when Fluent::Plugin::ServiceDiscovery::SERVICE_IN
Severity: Minor
Found in lib/fluent/plugin_helper/service_discovery/manager.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 extract_tag_from_record has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def extract_tag_from_record(record)
        return nil unless @_extract_enabled

        if @_extract_tag_key && record.has_key?(@_extract_tag_key)
          v = @_extract_keep_tag_key ? record[@_extract_tag_key] : record.delete(@_extract_tag_key)
Severity: Minor
Found in lib/fluent/plugin_helper/extract.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
        super

        @_storages_started = true
        @_storages.each_pair do |usage, s|
Severity: Minor
Found in lib/fluent/plugin_helper/storage.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 shutdown has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def shutdown
        @_event_loop_mutex.synchronize do
          @_event_loop_attached_watchers.reverse_each do |w|
            if w.attached?
              begin
Severity: Minor
Found in lib/fluent/plugin_helper/event_loop.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 elements has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def elements(*names, name: nil, arg: nil)
        raise ArgumentError, "name and names are exclusive" if name && !names.empty?
        raise ArgumentError, "arg is available only with name" if arg && !name

        if name
Severity: Minor
Found in lib/fluent/config/element.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

Avoid too many return statements within this method.
Open

                return 1
Severity: Major
Found in lib/fluent/plugin/buffer.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                    return -1
    Severity: Major
    Found in lib/fluent/plugin/buffer.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                return info, Result::SUCCESS
      Severity: Major
      Found in lib/fluent/plugin/out_forward/ack_handler.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                  return FAILED_RESULT
        Severity: Major
        Found in lib/fluent/plugin/filter_parser.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return if record.nil?
          Severity: Major
          Found in lib/fluent/plugin/in_forward.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                      return
            Severity: Major
            Found in lib/fluent/plugin/parser_syslog.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                    return true, shared_key_salt, shared_key
              Severity: Major
              Found in lib/fluent/plugin/in_forward.rb - About 30 mins to fix
                Severity
                Category
                Status
                Source
                Language