Skip to content

Commit 018b07a

Browse files
authored
Merge pull request #619 from snutij/snutij/warn-missing-benchmarks
feat(benchmark): display missing requests
2 parents c34d1b8 + 5b01b6c commit 018b07a

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

.github/workflows/benchmark.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ jobs:
5858
# Fail the job based on the benchmark output
5959
- name: Finalize job
6060
run: |
61-
if [[ "${{ steps.benchmark.outputs.REPORT }}" == *"At least one benchmark is slower than the main branch"* ]]; then
61+
REPORT="${{ steps.benchmark.outputs.REPORT }}"
62+
IS_SLOWER=$(grep "At least one benchmark is slower than the main branch" <<< "$REPORT")
63+
IS_MISSING=$(grep "Missing benchmarks" <<< "$REPORT")
64+
65+
if [[ $IS_SLOWER || $IS_MISSING ]]; then
6266
exit 1
6367
else
6468
exit 0

bin/benchmark

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,9 @@ requests = {
247247
"textDocument/hover" => base_params.merge(position: position),
248248
"textDocument/codeAction" => code_action_params,
249249
"textDocument/onTypeFormatting" => base_params.merge(position: { line: 1, character: 31 }, ch: "\n"),
250+
"codeAction/resolve" => base_params.merge(data: { range: range, uri: FILE_URI }),
251+
"textDocument/completion" => base_params.merge(position: position),
252+
"textDocument/codeLens" => base_params,
250253
}
251254

252255
results = {}
@@ -298,4 +301,20 @@ if File.exist?(CACHE_FILE_PATH)
298301
end
299302
end
300303

304+
requests_benchmarked = RubyLsp::Requests::BaseRequest.subclasses.concat(RubyLsp::Listener.subclasses)
305+
306+
Dir["#{Dir.pwd}/lib/ruby_lsp/requests/*.rb"].each { |file| require(file) }
307+
308+
all_requests = RubyLsp::Requests::BaseRequest.subclasses.concat(RubyLsp::Listener.subclasses)
309+
310+
missing_benchmarks = all_requests - requests_benchmarked
311+
312+
if missing_benchmarks.any?
313+
puts "\n\n"
314+
puts "=" * 80
315+
puts "Missing benchmarks:\n\n"
316+
puts missing_benchmarks.map(&:to_s)
317+
exit(1)
318+
end
319+
301320
File.write(CACHE_FILE_PATH, results.to_json)

0 commit comments

Comments
 (0)