karafka/karafka

View on GitHub
lib/karafka/cli/topics/plan.rb

Summary

Maintainability
C
1 day
Test Coverage

Method topics_to_alter has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

        def topics_to_alter
          return @topics_to_alter if @topics_to_alter

          topics_to_check = []

Severity: Minor
Found in lib/karafka/cli/topics/plan.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 call has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def call
          # If no changes at all, just print and stop
          if topics_to_create.empty? && topics_to_repartition.empty? && topics_to_alter.empty?
            puts "Karafka will #{yellow('not')} perform any actions. No changes needed."

Severity: Minor
Found in lib/karafka/cli/topics/plan.rb - About 1 hr to fix

    Method topics_to_alter has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def topics_to_alter
              return @topics_to_alter if @topics_to_alter
    
              topics_to_check = []
    
    
    Severity: Minor
    Found in lib/karafka/cli/topics/plan.rb - About 1 hr to fix

      Method call has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

              def call
                # If no changes at all, just print and stop
                if topics_to_create.empty? && topics_to_repartition.empty? && topics_to_alter.empty?
                  puts "Karafka will #{yellow('not')} perform any actions. No changes needed."
      
      
      Severity: Minor
      Found in lib/karafka/cli/topics/plan.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 topics_to_repartition has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

              def topics_to_repartition
                return @topics_to_repartition if @topics_to_repartition
      
                @topics_to_repartition = []
      
      
      Severity: Minor
      Found in lib/karafka/cli/topics/plan.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

      There are no issues that match your filters.

      Category
      Status