fluent/fluentd

View on GitHub
lib/fluent/plugin_helper/retry_state.rb

Summary

Maintainability
C
1 day
Test Coverage

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

        def calc_next_time
          if @forever || !@secondary # primary
            naive = naive_next_time(@steps)
            if @forever
              naive
Severity: Minor
Found in lib/fluent/plugin_helper/retry_state.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 11 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def initialize(title, wait, timeout, forever, max_steps, randomize, randomize_width, backoff_base, max_interval, secondary, secondary_threshold)
Severity: Major
Found in lib/fluent/plugin_helper/retry_state.rb - About 1 hr to fix

    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 initialize has 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            def initialize(title, wait, timeout, forever, max_steps, randomize, randomize_width, secondary, secondary_threshold)
    Severity: Major
    Found in lib/fluent/plugin_helper/retry_state.rb - About 1 hr to fix

      Method initialize has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              def initialize(title, wait, timeout, forever, max_steps, randomize, randomize_width, secondary, secondary_threshold)
      Severity: Major
      Found in lib/fluent/plugin_helper/retry_state.rb - About 1 hr to fix

        Method initialize has 28 lines of code (exceeds 25 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

          Method calc_next_time has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def calc_next_time
                    if @forever || !@secondary # primary
                      naive = naive_next_time(@steps)
                      if @forever
                        naive
          Severity: Minor
          Found in lib/fluent/plugin_helper/retry_state.rb - About 1 hr to fix

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

                    def calc_interval(num)
                      interval = raw_interval(num)
                      if @max_interval && interval > @max_interval
                        @max_interval
                      else
            Severity: Minor
            Found in lib/fluent/plugin_helper/retry_state.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

            There are no issues that match your filters.

            Category
            Status