DEV: Check English locale for errors in CI

Moves the most important checks into a linter. It gets executed by Lefthook as well as the docker rake task and Github actions. Doing those checks in rspec takes too long and it produces errors when the discourse:test Docker image contains old, invalid locale files.
This commit is contained in:
Gerhard Schlager
2020-06-03 21:35:08 +02:00
parent c200238bdc
commit f683c5d0e0
5 changed files with 158 additions and 104 deletions

View File

@@ -66,6 +66,7 @@ task 'docker:test' do
if ENV["SINGLE_PLUGIN"]
@good &&= run_or_fail("bundle exec rubocop --parallel plugins/#{ENV["SINGLE_PLUGIN"]}")
@good &&= run_or_fail("bundle exec ruby script/i18n_lint.rb plugins/#{ENV["SINGLE_PLUGIN"]}/config/locales/{client,server}.en.yml")
@good &&= run_or_fail("yarn eslint --global I18n --ext .es6 plugins/#{ENV['SINGLE_PLUGIN']}")
puts "Listing prettier offenses in #{ENV['SINGLE_PLUGIN']}:"
@@ -78,6 +79,9 @@ task 'docker:test' do
# TODO: remove --global I18n once plugins can be updated
@good &&= run_or_fail("yarn eslint --global I18n --ext .es6 plugins") unless ENV["SKIP_PLUGINS"]
@good &&= run_or_fail('bundle exec ruby script/i18n_lint.rb "config/locales/{client,server}.en.yml"') unless ENV["SKIP_CORE"]
@good &&= run_or_fail('bundle exec ruby script/i18n_lint.rb "plugins/**/locales/{client,server}.en.yml"') unless ENV["SKIP_PLUGINS"]
unless ENV["SKIP_CORE"]
puts "Listing prettier offenses in core:"
@good &&= run_or_fail('yarn prettier --list-different "app/assets/stylesheets/**/*.scss" "app/assets/javascripts/**/*.es6" "test/javascripts/**/*.es6"')