gitlabhq/gitlabhq

View on GitHub
scripts/review_apps/automated_cleanup.rb

Summary

Maintainability
A
1 hr
Test Coverage

Method perform_gitlab_environment_cleanup! has a Cognitive Complexity of 11 (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 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 delete_helm_release has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def delete_helm_release(release)
    print_release_state(subject: 'Release', release_name: release.name, release_status: release.status, release_date: release.last_update, action: 'cleaning')
    helm.delete(release_name: release.name)
    kubernetes.cleanup(release_name: release.name)
  rescue Quality::HelmClient::CommandFailedError => ex
Severity: Minor
Found in scripts/review_apps/automated_cleanup.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

There are no issues that match your filters.

Category
Status