diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-06-19 19:13:11 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-06-20 14:57:47 +0200 |
commit | fff6b89f0f51709e5c58be11e6b98e638383c678 (patch) | |
tree | 22394fe159c62025834b0b048699cc3292bf36c5 /lib/tasks/gettext.rake | |
parent | c815abbdc06fd37463b1383160a2aa1812729f4d (diff) | |
download | gitlab-ce-fff6b89f0f51709e5c58be11e6b98e638383c678.tar.gz |
More verbose errors in static-analysis
This makes the output in static analysis a bit more verbose.
Diffstat (limited to 'lib/tasks/gettext.rake')
-rw-r--r-- | lib/tasks/gettext.rake | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/tasks/gettext.rake b/lib/tasks/gettext.rake index d52c419d66b..d7c40cb6a12 100644 --- a/lib/tasks/gettext.rake +++ b/lib/tasks/gettext.rake @@ -53,25 +53,34 @@ namespace :gettext do task :updated_check do # Removing all pre-translated files speeds up `gettext:find` as the # files don't need to be merged. - `rm locale/*/gitlab.po` + # Having `LC_MESSAGES/gitlab.mo files present also confuses the output. + FileUtils.rm Dir['locale/**/gitlab.*'] + + # Make sure we start out with a clean pot.file + `git checkout -- locale/gitlab.pot` # `gettext:find` writes touches to temp files to `stderr` which would cause - # `static-analysis` to report failures. We can ignore these - silence_stream(STDERR) { Rake::Task['gettext:find'].invoke } + # `static-analysis` to report failures. We can ignore these. + silence_stream($stderr) do + Rake::Task['gettext:find'].invoke + end - changed_files = `git diff --name-only`.lines.map(&:strip) + pot_diff = `git diff -- locale/gitlab.pot`.strip # reset the locale folder for potential next tasks `git checkout -- locale` - if changed_files.include?('locale/gitlab.pot') + if pot_diff.present? raise <<~MSG Newly translated strings found, please add them to `gitlab.pot` by running: - bundle exec rake gettext:find; git checkout -- locale/*/gitlab.po; + rm locale/**/gitlab.*; bin/rake gettext:find; git checkout -- locale/*/gitlab.po Then commit and push the resulting changes to `locale/gitlab.pot`. + The diff was: + + #{pot_diff} MSG end end |