cleanup.rb
Method clean_up_impl
has a Cognitive Complexity of 82 (exceeds 5 allowed). Consider refactoring. Open
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
- Read upRead up
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
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
Method clean_up_impl
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
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)
Method clean_up
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def clean_up(client, repository, results_repository, results_path, age_limit, limits)
Avoid deeply nested control flow statements. Open
Open
if pr.number.to_s == file_data["pull_request_issue_id"].to_s
# matching open pr found
pr_found = true
break
end
Avoid deeply nested control flow statements. Wontfix
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
Avoid deeply nested control flow statements. Open
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}