Use the --parallel Rubocop flag in the static-analysis and improve the job

Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
Rémy Coutable 2017-11-03 17:00:49 +01:00
parent 97b80fefeb
commit d048c8fe43
No known key found for this signature in database
GPG Key ID: 46DF07E5CD9E96AB
1 changed files with 16 additions and 7 deletions

View File

@ -11,31 +11,40 @@ tasks = [
%w[bundle exec rake brakeman],
%w[bundle exec license_finder],
%w[yarn run eslint],
%w[bundle exec rubocop --require rubocop-rspec],
%w[bundle exec rubocop --parallel],
%w[scripts/lint-conflicts.sh],
%w[bundle exec rake gettext:lint],
%w[scripts/lint-changelog-yaml]
]
failed_tasks = tasks.reduce({}) do |failures, task|
output, status = Gitlab::Popen.popen(task)
start = Time.now
puts
puts "$ #{task.join(' ')}"
puts "Running: #{task.join(' ')}"
puts output
output, status = Gitlab::Popen.popen(task)
puts "==> Finished in #{Time.now - start} seconds"
puts
failures[task.join(' ')] = output unless status.zero?
failures
end
puts
puts '==================================================='
puts
puts
if failed_tasks.empty?
puts 'All static analyses passed successfully.'
else
puts "\n===================================================\n\n"
puts "Some static analyses failed:"
puts 'Some static analyses failed:'
failed_tasks.each do |failed_task, output|
puts "\n**** #{failed_task} failed with the following error:\n\n"
puts
puts "**** #{failed_task} failed with the following error:"
puts
puts output
end