blob: c5d0f2c292fe347c0a04c2fd9a02a1c604d87065 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
unless Rails.env.production?
namespace :lint do
task :static_verification_env do
ENV['STATIC_VERIFICATION'] = 'true'
end
desc "GitLab | lint | Static verification"
task static_verification: %w[
lint:static_verification_env
dev:load
] do
Gitlab::Utils::Override.verify!
end
desc "GitLab | lint | Lint JavaScript files using ESLint"
task :javascript do
Rake::Task['eslint'].invoke
end
desc "GitLab | lint | Lint HAML files"
task :haml do
Rake::Task['haml_lint'].invoke
rescue RuntimeError # The haml_lint tasks raise a RuntimeError
exit(1)
end
desc "GitLab | lint | Run several lint checks"
task :all do
status = 0
%w[
config_lint
lint:haml
scss_lint
gettext:lint
gettext:updated_check
lint:static_verification
].each do |task|
pid = Process.fork do
rd_out, wr_out = IO.pipe
rd_err, wr_err = IO.pipe
stdout = $stdout.dup
stderr = $stderr.dup
$stdout.reopen(wr_out)
$stderr.reopen(wr_err)
begin
Rake::Task[task].invoke
rescue SystemExit => ex
msg = "*** Rake task #{task} exited:"
raise ex
rescue => ex
msg = "*** Rake task #{task} raised #{ex.class}:"
raise ex
ensure
$stdout.reopen(stdout)
$stderr.reopen(stderr)
wr_out.close
wr_err.close
warn "\n#{msg}\n\n" if msg
IO.copy_stream(rd_out, $stdout)
IO.copy_stream(rd_err, $stderr)
end
end
Process.waitpid(pid)
status += $?.exitstatus
end
exit(status)
end
end
end
|