Skip to content

Commit 15da6c3

Browse files
authored
Add rubocop-i18n linter (mastodon#34057)
1 parent 37b79c6 commit 15da6c3

File tree

5 files changed

+21
-2
lines changed

5 files changed

+21
-2
lines changed

.rubocop.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ inherit_from:
1818
- .rubocop/rspec_rails.yml
1919
- .rubocop/rspec.yml
2020
- .rubocop/style.yml
21+
- .rubocop/i18n.yml
2122
- .rubocop/custom.yml
2223
- .rubocop_todo.yml
2324
- .rubocop/strict.yml
@@ -30,6 +31,7 @@ plugins:
3031
- rubocop-rails
3132
- rubocop-rspec
3233
- rubocop-performance
34+
- rubocop-i18n
3335

3436
require:
3537
- rubocop-rspec_rails

.rubocop/i18n.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
I18n/RailsI18n:
2+
Enabled: true
3+
Exclude:
4+
- 'config/**/*'
5+
- 'db/**/*'
6+
- 'lib/**/*'
7+
- 'spec/**/*'
8+
I18n/GetText:
9+
Enabled: false
10+
11+
I18n/RailsI18n/DecorateStringFormattingUsingInterpolation:
12+
Enabled: false

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ group :development do
165165
# Code linting CLI and plugins
166166
gem 'rubocop', require: false
167167
gem 'rubocop-capybara', require: false
168+
gem 'rubocop-i18n', require: false
168169
gem 'rubocop-performance', require: false
169170
gem 'rubocop-rails', require: false
170171
gem 'rubocop-rspec', require: false

Gemfile.lock

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ GEM
719719
rspec-mocks (~> 3.0)
720720
sidekiq (>= 5, < 8)
721721
rspec-support (3.13.2)
722-
rubocop (1.73.1)
722+
rubocop (1.73.2)
723723
json (~> 2.3)
724724
language_server-protocol (~> 3.17.0.2)
725725
lint_roller (~> 1.1.0)
@@ -734,6 +734,9 @@ GEM
734734
parser (>= 3.3.1.0)
735735
rubocop-capybara (2.21.0)
736736
rubocop (~> 1.41)
737+
rubocop-i18n (3.2.3)
738+
lint_roller (~> 1.1)
739+
rubocop (>= 1.72.1)
737740
rubocop-performance (1.24.0)
738741
lint_roller (~> 1.1)
739742
rubocop (>= 1.72.1, < 2.0)
@@ -1016,6 +1019,7 @@ DEPENDENCIES
10161019
rspec-sidekiq (~> 5.0)
10171020
rubocop
10181021
rubocop-capybara
1022+
rubocop-i18n
10191023
rubocop-performance
10201024
rubocop-rails
10211025
rubocop-rspec

app/lib/video_metadata_extractor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def initialize(path)
1212
rescue Terrapin::ExitStatusError, Oj::ParseError
1313
@invalid = true
1414
rescue Terrapin::CommandNotFoundError
15-
raise Paperclip::Errors::CommandNotFoundError, 'Could not run the `ffprobe` command. Please install ffmpeg.'
15+
raise Paperclip::Errors::CommandNotFoundError, 'Could not run the `ffprobe` command. Please install ffmpeg.' # rubocop:disable I18n/RailsI18n/DecorateString -- This error is not user-facing
1616
end
1717

1818
def valid?

0 commit comments

Comments
 (0)