From 9b3f728cca163e1e6c0a67b932bbd04f74896d87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Fri, 28 Apr 2017 17:31:18 +0200 Subject: Add scripts/static-analysis to run all the static analysers in one go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- scripts/static-analysis | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 scripts/static-analysis (limited to 'scripts') diff --git a/scripts/static-analysis b/scripts/static-analysis new file mode 100755 index 00000000000..192d9d4c3ba --- /dev/null +++ b/scripts/static-analysis @@ -0,0 +1,40 @@ +#!/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 -- cgit v1.2.3