Skip to content

Commit

Permalink
pass
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed May 27, 2024
1 parent c3ad26c commit 8c5dac8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
3 changes: 2 additions & 1 deletion judges/github-events/github-events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ def put_new_event(fbt, json)
largest = fb.query(
"(eq event_id
(agg (eq repository #{octo.repo_id_by_name(repo)})
(max event_id)))").each.to_a[0]
(max event_id)))"
).each.to_a[0]
largest = largest.event_id unless largest.nil?
octo.through_pages(:repository_events, repo) do |json|
next unless fb.query("(eq event_id #{json[:id]})").each.to_a.empty?
Expand Down
6 changes: 3 additions & 3 deletions judges/label-was-attached/label-was-attached.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
(eq issue (agg (gt issue #{latest}) (min issue))))"
follow 'repository issue'
threshold $options.max_labels || 16
maybe do |n, opened|
maybe do |n, _opened|
octo.through_pages(:issue_timeline, n.repository, n.issue) do |te|
next unless te[:event] == 'labeled'
badge = te[:label][:name]
Expand All @@ -42,8 +42,8 @@
n.who = te[:actor][:id]
n.when = te[:created_at]
break "The '##{n.label}' label was attached by @#{te[:actor][:login]} " \
"to the issue #{te[:repository][:full_name]}##{n.issue} at #{n.when}, " \
'; which may trigger future judges.'
"to the issue #{te[:repository][:full_name]}##{n.issue} at #{n.when}, " \
'; which may trigger future judges.'
end
end
end
14 changes: 7 additions & 7 deletions lib/conclude.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def maybe(&)
end

def consider(&)
roll do |fbt, a|
roll do |_fbt, a|
f = a.shift
fill(f, a, &)
nil
Expand All @@ -95,17 +95,17 @@ def roll(&)
end
end

def fill(n, a)
def fill(fact, others)
@follows.each do |i, props|
props.each do |p|
v = a[i].send(p)
n.send("#{p}=", v)
v = others[i].send(p)
fact.send("#{p}=", v)
end
end
r = yield [n] + a
r = yield [fact] + others
return unless r.is_a?(String)
n.details = r
n.what = @judge
fact.details = r
fact.what = @judge
end
end

Expand Down
8 changes: 3 additions & 5 deletions lib/octo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,14 @@ def o.repo_id_by_name(name)
$loog.debug("GitHub repository #{id} has an ID: #{id}")
id
end
def o.through_pages(*args)
def o.through_pages(*args, &block)
m = args.shift
page = 1
catch :break do
loop do
r = send(m, *(args + [{ page: }]))
break if r.empty?
r.each do |json|
yield json
end
r.each(&block)
page += 1
end
end
Expand Down Expand Up @@ -108,7 +106,7 @@ def user(name)
{
id: 444,
login: 'yegor256',
type: name == 29139614 ? 'Bot' : 'User'
type: name == 29_139_614 ? 'Bot' : 'User'
}
end

Expand Down

0 comments on commit 8c5dac8

Please sign in to comment.