summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-04-28 17:31:18 +0200
committerRobert Speicher <rspeicher@gmail.com>2017-05-01 11:04:13 -0400
commit9b3f728cca163e1e6c0a67b932bbd04f74896d87 (patch)
tree0ff3efe0dc55b933085cbdee9af2bb1ebe5bfc53
parentf2fc716c4f00caf4d0184caf19c930e2d37bb6c8 (diff)
downloadgitlab-ce-31463-group-all-linters.tar.gz
Add scripts/static-analysis to run all the static analysers in one go31463-group-all-linters
Signed-off-by: Rémy Coutable <remy@rymai.me>
-rw-r--r--.gitlab-ci.yml10
-rwxr-xr-xscripts/static-analysis40
2 files changed, 41 insertions, 9 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6b411c4df07..dab1b220bfb 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -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
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