summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/tasks/lint.rake49
-rwxr-xr-xscripts/static-analysis11
2 files changed, 52 insertions, 8 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
diff --git a/scripts/static-analysis b/scripts/static-analysis
index bdb88f3cb57..0e67eabfec1 100755
--- a/scripts/static-analysis
+++ b/scripts/static-analysis
@@ -7,7 +7,7 @@ require_relative '../lib/gitlab/popen/runner'
def emit_warnings(static_analysis)
static_analysis.warned_results.each do |result|
puts
- puts "**** #{result.cmd.join(' ')} had the following warnings:"
+ puts "**** #{result.cmd.join(' ')} had the following warning(s):"
puts
puts result.stderr
puts
@@ -17,7 +17,7 @@ end
def emit_errors(static_analysis)
static_analysis.failed_results.each do |result|
puts
- puts "**** #{result.cmd.join(' ')} failed with the following error:"
+ puts "**** #{result.cmd.join(' ')} failed with the following error(s):"
puts
puts result.stdout
puts result.stderr
@@ -26,15 +26,10 @@ def emit_errors(static_analysis)
end
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[bin/rake lint:all],
%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-conflicts.sh],
%w[scripts/lint-rugged]
]