diff options
author | Robert Speicher <robert@gitlab.com> | 2018-02-16 18:06:56 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2018-02-16 18:06:56 +0000 |
commit | dfb14e4d22aa91d9d3fbcee5c7e44ae61bf18c51 (patch) | |
tree | 45323268819b6231846fab647a08103f8520c965 /lib | |
parent | 71ba3982636d19b6c8208180ff5626a405cc23fc (diff) | |
parent | 2f0d2ab55b6deac79f81834f6724a676ceae94ae (diff) | |
download | gitlab-ce-dfb14e4d22aa91d9d3fbcee5c7e44ae61bf18c51.tar.gz |
Merge branch '42050-combine-all-rake-based-lints-in-one-rake-process-in-ci' into 'master'
Resolve "Combine all rake based lints in one rake process in CI"
Closes #42050
See merge request gitlab-org/gitlab-ce!16732
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tasks/lint.rake | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/lib/tasks/lint.rake b/lib/tasks/lint.rake index 3ab406eff2c..fe5032cae18 100644 --- a/lib/tasks/lint.rake +++ b/lib/tasks/lint.rake @@ -16,5 +16,54 @@ unless Rails.env.production? task :javascript do Rake::Task['eslint'].invoke end + + desc "GitLab | lint | Run several lint checks" + task :all do + status = 0 + + %w[ + config_lint + haml_lint + scss_lint + flay + gettext:lint + lint:static_verification + ].each do |task| + pid = Process.fork do + rd, wr = IO.pipe + stdout = $stdout.dup + stderr = $stderr.dup + $stdout.reopen(wr) + $stderr.reopen(wr) + + begin + begin + Rake::Task[task].invoke + rescue RuntimeError # The haml_lint tasks raise a RuntimeError + exit(1) + end + rescue SystemExit => ex + msg = "*** Rake task #{task} failed with the following error(s):" + raise ex + ensure + $stdout.reopen(stdout) + $stderr.reopen(stderr) + wr.close + + if msg + warn "\n#{msg}\n\n" + IO.copy_stream(rd, $stderr) + else + IO.copy_stream(rd, $stdout) + end + end + end + + Process.waitpid(pid) + status += $?.exitstatus + end + + exit(status) + end end end |