Skip to content

Commit

Permalink
chore: log result size to spinner
Browse files Browse the repository at this point in the history
  • Loading branch information
markokajzer committed Feb 10, 2024
1 parent 6b6f841 commit 045db77
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/code_review_leaderboard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ def initialize!
end

def start
puts "Found #{repositories.size} repositories" if Config.organization.present? && Config.log_level == :debug
puts "Found #{pulls.size} pull requests."
puts "Found #{reviews.size} reviews."
puts

puts Formatter.new(reviews).to_table
end

Expand All @@ -38,6 +33,7 @@ def repositories
Spinner.start do
Spinner.status = "Fetching repos for #{Config.organization}..."
Organization.new(name: Config.organization).repos
.tap { Spinner.status = "Found #{_1.size} repositories." }
end
end
end
Expand All @@ -51,14 +47,19 @@ def pulls
Spinner.status = "Fetching pull requests..."

WaitAllThrottled(repositories) { _1.pulls }
.tap { Spinner.status = "Found #{_1.size} pull requests." }
end
end
alias_method :load_pulls, :pulls

def reviews
load_pulls

@@reviews ||= Spinner.start do
Spinner.status = "Fetching reviews..."

WaitAllThrottled(pulls) { Reviews.for(pull: _1) }
.tap { Spinner.status = "Found #{_1.size} reviews.\n" }
end
end
end

0 comments on commit 045db77

Please sign in to comment.