2017-08-17 22:00:37 +05:30
|
|
|
unless Rails.env.production?
|
|
|
|
namespace :lint do
|
2018-03-17 18:26:18 +05:30
|
|
|
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
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
desc "GitLab | lint | Lint JavaScript files using ESLint"
|
|
|
|
task :javascript do
|
|
|
|
Rake::Task['eslint'].invoke
|
|
|
|
end
|
2018-03-27 19:54:05 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
desc "GitLab | lint | Lint HAML files"
|
|
|
|
task :haml do
|
2019-07-07 11:18:12 +05:30
|
|
|
Rake::Task['haml_lint'].invoke
|
|
|
|
rescue RuntimeError # The haml_lint tasks raise a RuntimeError
|
|
|
|
exit(1)
|
2018-11-08 19:23:39 +05:30
|
|
|
end
|
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
desc "GitLab | lint | Run several lint checks"
|
|
|
|
task :all do
|
|
|
|
status = 0
|
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
tasks = %w[
|
2018-03-27 19:54:05 +05:30
|
|
|
config_lint
|
2018-11-08 19:23:39 +05:30
|
|
|
lint:haml
|
2018-03-27 19:54:05 +05:30
|
|
|
scss_lint
|
|
|
|
gettext:lint
|
|
|
|
lint:static_verification
|
2019-12-04 20:38:33 +05:30
|
|
|
]
|
|
|
|
|
|
|
|
if Gitlab.ee?
|
|
|
|
# This task will fail on CE installations (e.g. gitlab-org/gitlab-foss)
|
|
|
|
# since it will detect strings in the locale files that do not exist in
|
|
|
|
# the source files. To work around this we will only enable this task on
|
|
|
|
# EE installations.
|
|
|
|
tasks << 'gettext:updated_check'
|
|
|
|
end
|
|
|
|
|
|
|
|
tasks.each do |task|
|
2018-03-27 19:54:05 +05:30
|
|
|
pid = Process.fork do
|
2019-09-04 21:01:54 +05:30
|
|
|
puts "*** Running rake task: #{task} ***"
|
|
|
|
|
|
|
|
Rake::Task[task].invoke
|
|
|
|
rescue SystemExit => ex
|
|
|
|
warn "!!! Rake task #{task} exited:"
|
|
|
|
raise ex
|
|
|
|
rescue StandardError, ScriptError => ex
|
|
|
|
warn "!!! Rake task #{task} raised #{ex.class}:"
|
|
|
|
raise ex
|
2018-03-27 19:54:05 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
Process.waitpid(pid)
|
|
|
|
status += $?.exitstatus
|
|
|
|
end
|
|
|
|
|
|
|
|
exit(status)
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|