Myoldmopar/decent_ci

View on GitHub
cleanup.rb

Summary

Maintainability
D
2 days
Test Coverage

Method clean_up_impl has a Cognitive Complexity of 82 (exceeds 5 allowed). Consider refactoring.
Open

def clean_up_impl(client, repository, results_repository, results_path, age_limit,
                 limit_reached, long_running_branches, feature_branch_limit, long_running_branch_limit, branches, releases, pull_requests)
  if $logger.nil?
    logger = Logger.new(STDOUT)
  else
Severity: Minor
Found in cleanup.rb - About 1 day 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 clean_up_impl has 139 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def clean_up_impl(client, repository, results_repository, results_path, age_limit,
                 limit_reached, long_running_branches, feature_branch_limit, long_running_branch_limit, branches, releases, pull_requests)
  if $logger.nil?
    logger = Logger.new(STDOUT)
  else
Severity: Major
Found in cleanup.rb - About 5 hrs to fix

    Method clean_up_impl has 12 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def clean_up_impl(client, repository, results_repository, results_path, age_limit,
                     limit_reached, long_running_branches, feature_branch_limit, long_running_branch_limit, branches, releases, pull_requests)
    Severity: Major
    Found in cleanup.rb - About 1 hr to fix

      Method clean_up has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def clean_up(client, repository, results_repository, results_path, age_limit, limits)
      Severity: Minor
      Found in cleanup.rb - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                    if pr.number.to_s == file_data["pull_request_issue_id"].to_s
                      # matching open pr found
                      pr_found = true
                      break
                    end
        Severity: Major
        Found in cleanup.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Wontfix

                    unless pr_found
                      logger.info("PR #{file_data["pull_request_issue_id"]} not found, queuing results file for deletion: #{file_data["title"]}")
                      files_for_deletion << file
                      prs_deleted << file_data["pull_request_issue_id"]
                    end
          Severity: Major
          Found in cleanup.rb - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                    elsif !branch_name.nil? && branch_name != "" && (file_data["pull_request_issue_id"].nil? || file_data["pull_request_issue_id"] == "")
                      logger.debug("Examining branch #{branch_name} commit #{file_data["commit_sha"]}")
            
                      file_key = {:device_id => file_data["device_id"], :branch_name => branch_name}
                      file_data = {:date => file_data["date"], :file => file}
            Severity: Major
            Found in cleanup.rb - About 45 mins to fix

              There are no issues that match your filters.

              Category
              Status