Add rubocop-i18n linter (#34057)

This commit is contained in:
Damien Mathieu 2025-03-04 14:28:33 +01:00 committed by GitHub
parent 37b79c638f
commit 15da6c3c83
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 21 additions and 2 deletions

View file

@ -18,6 +18,7 @@ inherit_from:
- .rubocop/rspec_rails.yml - .rubocop/rspec_rails.yml
- .rubocop/rspec.yml - .rubocop/rspec.yml
- .rubocop/style.yml - .rubocop/style.yml
- .rubocop/i18n.yml
- .rubocop/custom.yml - .rubocop/custom.yml
- .rubocop_todo.yml - .rubocop_todo.yml
- .rubocop/strict.yml - .rubocop/strict.yml
@ -30,6 +31,7 @@ plugins:
- rubocop-rails - rubocop-rails
- rubocop-rspec - rubocop-rspec
- rubocop-performance - rubocop-performance
- rubocop-i18n
require: require:
- rubocop-rspec_rails - rubocop-rspec_rails

12
.rubocop/i18n.yml Normal file
View file

@ -0,0 +1,12 @@
I18n/RailsI18n:
Enabled: true
Exclude:
- 'config/**/*'
- 'db/**/*'
- 'lib/**/*'
- 'spec/**/*'
I18n/GetText:
Enabled: false
I18n/RailsI18n/DecorateStringFormattingUsingInterpolation:
Enabled: false

View file

@ -165,6 +165,7 @@ group :development do
# Code linting CLI and plugins # Code linting CLI and plugins
gem 'rubocop', require: false gem 'rubocop', require: false
gem 'rubocop-capybara', require: false gem 'rubocop-capybara', require: false
gem 'rubocop-i18n', require: false
gem 'rubocop-performance', require: false gem 'rubocop-performance', require: false
gem 'rubocop-rails', require: false gem 'rubocop-rails', require: false
gem 'rubocop-rspec', require: false gem 'rubocop-rspec', require: false

View file

@ -719,7 +719,7 @@ GEM
rspec-mocks (~> 3.0) rspec-mocks (~> 3.0)
sidekiq (>= 5, < 8) sidekiq (>= 5, < 8)
rspec-support (3.13.2) rspec-support (3.13.2)
rubocop (1.73.1) rubocop (1.73.2)
json (~> 2.3) json (~> 2.3)
language_server-protocol (~> 3.17.0.2) language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0) lint_roller (~> 1.1.0)
@ -734,6 +734,9 @@ GEM
parser (>= 3.3.1.0) parser (>= 3.3.1.0)
rubocop-capybara (2.21.0) rubocop-capybara (2.21.0)
rubocop (~> 1.41) rubocop (~> 1.41)
rubocop-i18n (3.2.3)
lint_roller (~> 1.1)
rubocop (>= 1.72.1)
rubocop-performance (1.24.0) rubocop-performance (1.24.0)
lint_roller (~> 1.1) lint_roller (~> 1.1)
rubocop (>= 1.72.1, < 2.0) rubocop (>= 1.72.1, < 2.0)
@ -1016,6 +1019,7 @@ DEPENDENCIES
rspec-sidekiq (~> 5.0) rspec-sidekiq (~> 5.0)
rubocop rubocop
rubocop-capybara rubocop-capybara
rubocop-i18n
rubocop-performance rubocop-performance
rubocop-rails rubocop-rails
rubocop-rspec rubocop-rspec

View file

@ -12,7 +12,7 @@ class VideoMetadataExtractor
rescue Terrapin::ExitStatusError, Oj::ParseError rescue Terrapin::ExitStatusError, Oj::ParseError
@invalid = true @invalid = true
rescue Terrapin::CommandNotFoundError rescue Terrapin::CommandNotFoundError
raise Paperclip::Errors::CommandNotFoundError, 'Could not run the `ffprobe` command. Please install ffmpeg.' raise Paperclip::Errors::CommandNotFoundError, 'Could not run the `ffprobe` command. Please install ffmpeg.' # rubocop:disable I18n/RailsI18n/DecorateString -- This error is not user-facing
end end
def valid? def valid?