sonots/fluent-mixin-elapsed_time

View on GitHub

Showing 8 of 8 total issues

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

    def on_message(msg)
      if msg.nil?
        # for future TCP heartbeat_request
        return
      end
Severity: Minor
Found in benchmark/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 flush has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

      def flush(now)
        times, sizes = [], []
        @mutex.synchronize do
          times = @times.dup
          sizes = @sizes.dup
Severity: Minor
Found in benchmark/plugin/in_forward.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 on_message has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def on_message(msg)
      if msg.nil?
        # for future TCP heartbeat_request
        return
      end
Severity: Minor
Found in benchmark/plugin/in_forward.rb - About 1 hr to fix

    Method flush has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def flush(now)
          times = []
          @mutex.synchronize do
            times = @times.dup
            @times.clear
    Severity: Minor
    Found in lib/fluent/plugin/measure_timable.rb - About 45 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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def initialize(io, linger_timeout, log, on_message, elapsed)
    Severity: Minor
    Found in benchmark/plugin/in_forward.rb - About 35 mins to fix

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

          def configure(conf)
            @tag = conf['tag'] || 'measure_time'
            unless @hook = conf['hook']
              raise Fluent::ConfigError, '`hook` option must be specified in <measure_time></measure_time> directive'
            end
      Severity: Minor
      Found in lib/fluent/plugin/measure_timable.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def run
              @last_checked ||= Engine.now
              while (sleep 0.5)
                begin
                  now = Engine.now
      Severity: Minor
      Found in benchmark/plugin/in_forward.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def run
            @last_checked ||= ::Fluent::Engine.now
            while (sleep 0.5)
              begin
                now = ::Fluent::Engine.now
      Severity: Minor
      Found in lib/fluent/plugin/measure_timable.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