fluent/fluentd

View on GitHub

Showing 577 of 664 total issues

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 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 extract_time_from_record has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def extract_time_from_record(record)
        return nil unless @_extract_enabled

        if @_extract_time_key && record.has_key?(@_extract_time_key)
          v = @_extract_keep_time_key ? record[@_extract_time_key] : record.delete(@_extract_time_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

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 -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
        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
          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 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 true, shared_key_salt, shared_key
              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 Proc.new {|time|
                            time = time.to_time
                            format.exec(time.localtime(tz.period_for_utc(time).utc_total_offset))
                          }
                Severity: Major
                Found in lib/fluent/timezone.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                            return Proc.new {|time|
                              time = time.to_time
                              time.localtime(tz.period_for_utc(time).utc_total_offset).iso8601
                            }
                  Severity: Major
                  Found in lib/fluent/timezone.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

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

                      Avoid too many return statements within this method.
                      Open

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

                        Avoid too many return statements within this method.
                        Open

                                  return Proc.new {|time|
                                    time = time.to_time
                                    time.localtime(tz.period_for_utc(time).utc_total_offset).strftime(format)
                                  }
                        Severity: Major
                        Found in lib/fluent/timezone.rb - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

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

                            Method overwrite? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def overwrite?(dest)
                                return true if @overwrite_all
                                loop do
                                  print "Overwrite #{dest}? (enter \"h\" for help) [Ynaqh]"
                                  answer = $stdin.gets.chomp
                            Severity: Minor
                            Found in lib/fluent/command/plugin_generator.rb - About 25 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 plugin_info_by_tag has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def plugin_info_by_tag(tag, opts={})
                                  matches = Fluent::Engine.root_agent.event_router.instance_variable_get(:@match_rules)
                                  matches.each { |rule|
                                    if rule.match?(tag)
                                      if rule.collector.is_a?(Fluent::Plugin::Output) || rule.collector.is_a?(Fluent::Output)
                            Severity: Minor
                            Found in lib/fluent/plugin/in_monitor_agent.rb - About 25 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