Skip to content

Commit a7d4777

Browse files
handle rubocop server restart
1 parent 5b3f6eb commit a7d4777

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/metric_fu/metrics/rubocop/generator.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ def run(args)
2828
# @note passing in false to report will return a hash
2929
# instead of the default String
3030
# ::Rubocop::RubocopCalculator.new(args).report(false)
31-
results = JSON.parse(`rubocop --format html --out rubocop.html --format json`)
31+
output = `rubocop --format html --out rubocop.html --format json`
32+
while output =~ /RuboCop server starting/
33+
output = `rubocop --format html --out rubocop.html --format json`
34+
end
35+
results = JSON.parse(output)
3236
summary = results.delete('summary')
3337
summary.each do |k, v|
3438
results[k] = v

0 commit comments

Comments
 (0)