Commit 9b3f728c authored by Rémy Coutable's avatar Rémy Coutable Committed by Robert Speicher

Add scripts/static-analysis to run all the static analysers in one go

Signed-off-by: 's avatarRémy Coutable <remy@rymai.me>
parent f2fc716c
......@@ -267,15 +267,7 @@ static-analysis:
<<: *except-docs
stage: test
script:
- bundle exec rake config_lint
- bundle exec rake flay
- bundle exec rake haml_lint
- bundle exec rake scss_lint
- bundle exec rake brakeman
- bundle exec license_finder
- scripts/lint-doc.sh
- yarn run eslint
- bundle exec "rubocop --require rubocop-rspec"
- scripts/static-analysis
downtime_check:
<<: *rake-exec
......
#!/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 rake brakeman],
%w[bundle exec license_finder],
%w[scripts/lint-doc.sh],
%w[yarn run eslint],
%w[bundle exec rubocop --require rubocop-rspec]
]
failed_tasks = tasks.reduce({}) do |failures, task|
output, status = Gitlab::Popen.popen(task)
puts "Running: #{task.join(' ')}"
puts output
failures[task.join(' ')] = output unless status.zero?
failures
end
if failed_tasks.empty?
puts 'All static analyses passed successfully.'
else
puts "\n===================================================\n\n"
puts "Some static analyses failed:"
failed_tasks.each do |failed_task, output|
puts "\n**** #{failed_task} failed with the following error:\n\n"
puts output
end
exit 1
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment