gitlab-org--gitlab-foss/scripts/static-analysis
2017-12-26 17:18:10 +08:00

51 lines
1.1 KiB
Ruby
Executable file

#!/usr/bin/env ruby
require ::File.expand_path('../lib/gitlab/popen', __dir__)
tasks = [
%w[bundle exec rake config_lint],
%w[bundle exec rake flay],
%w[bundle exec rake haml_lint],
%w[bundle exec rake scss_lint],
%w[bundle exec license_finder],
%w[yarn run eslint],
%w[bundle exec rubocop --parallel],
%w[bundle exec rake gettext:lint],
%w[bundle exec rake lint:static_verification],
%w[scripts/lint-changelog-yaml],
%w[scripts/lint-conflicts.sh]
]
failed_tasks = tasks.reduce({}) do |failures, task|
start = Time.now
puts
puts "$ #{task.join(' ')}"
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 'Some static analyses failed:'
failed_tasks.each do |failed_task, output|
puts
puts "**** #{failed_task} failed with the following error:"
puts
puts output
end
exit 1
end