gitlabhq/gitlabhq

View on GitHub
scripts/review_apps/automated_cleanup.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Method perform_gitlab_environment_cleanup! has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def perform_gitlab_environment_cleanup!(days_for_stop:, days_for_delete:)
    puts "Checking for review apps not updated in the last #{days_for_stop} days..."

    checked_environments = []
    delete_threshold = threshold_time(days: days_for_delete)
Severity: Minor
Found in scripts/review_apps/automated_cleanup.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 perform_gitlab_environment_cleanup! has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def perform_gitlab_environment_cleanup!(days_for_stop:, days_for_delete:)
    puts "Checking for review apps not updated in the last #{days_for_stop} days..."

    checked_environments = []
    delete_threshold = threshold_time(days: days_for_delete)
Severity: Minor
Found in scripts/review_apps/automated_cleanup.rb - About 1 hr to fix

    Method delete_helm_releases has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      def delete_helm_releases(releases)
        return if releases.empty?
    
        releases.each do |release|
          print_release_state(subject: 'Release', release_name: release.name, release_status: release.status, release_date: release.last_update, action: 'cleaning')
    Severity: Minor
    Found in scripts/review_apps/automated_cleanup.rb - About 55 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 perform_helm_releases_cleanup! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def perform_helm_releases_cleanup!(days:)
        puts "Checking for Helm releases not updated in the last #{days} days..."
    
        threshold_day = threshold_time(days: days)
    
    
    Severity: Minor
    Found in scripts/review_apps/automated_cleanup.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