mirror of
https://github.com/mastodon/mastodon.git
synced 2025-01-06 10:25:09 +01:00
Ignore Style/WordArray in languages_helper
This commit is contained in:
parent
d65e246192
commit
44026b16be
@ -103,10 +103,3 @@ Style/RedundantConstantBase:
|
||||
Exclude:
|
||||
- 'config/environments/production.rb'
|
||||
- 'config/initializers/sidekiq.rb'
|
||||
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: WordRegex.
|
||||
# SupportedStyles: percent, brackets
|
||||
Style/WordArray:
|
||||
EnforcedStyle: percent
|
||||
MinSize: 3
|
||||
|
@ -1,6 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module LanguagesHelper
|
||||
# rubocop:disable Style/WordArray
|
||||
ISO_639_1 = {
|
||||
aa: ['Afar', 'Afaraf'].freeze,
|
||||
ab: ['Abkhaz', 'аҧсуа бызшәа'].freeze,
|
||||
@ -222,6 +223,8 @@ module LanguagesHelper
|
||||
'zh-YUE': ['Cantonese', '廣東話'].freeze,
|
||||
}.freeze
|
||||
|
||||
# rubocop:enable Style/WordArray
|
||||
|
||||
SUPPORTED_LOCALES = {}.merge(ISO_639_1).merge(ISO_639_1_REGIONAL).merge(ISO_639_3).freeze
|
||||
|
||||
# For ISO-639-1 and ISO-639-3 language codes, we have their official
|
||||
|
@ -69,7 +69,7 @@ module Attachmentable
|
||||
original_extension = Paperclip::Interpolations.extension(attachment, :original)
|
||||
proper_extension = extensions_for_mime_type.first.to_s
|
||||
extension = extensions_for_mime_type.include?(original_extension) ? original_extension : proper_extension
|
||||
extension = 'jpeg' if ['jpe', 'jfif'].include?(extension)
|
||||
extension = 'jpeg' if %w(jpe jfif).include?(extension)
|
||||
|
||||
extension
|
||||
end
|
||||
|
@ -45,7 +45,7 @@ RSpec.describe 'Apps' do
|
||||
client_secret_expires_at: 0,
|
||||
name: client_name,
|
||||
website: website,
|
||||
scopes: ['read', 'write'],
|
||||
scopes: %w(read write),
|
||||
redirect_uris: redirect_uris,
|
||||
# Deprecated properties as of 4.3:
|
||||
redirect_uri: redirect_uri,
|
||||
|
@ -12,7 +12,7 @@ RSpec.describe REST::AccountWarningSerializer do
|
||||
expect(subject)
|
||||
.to include(
|
||||
'id' => be_a(String).and(eq('123')),
|
||||
'status_ids' => be_a(Array).and(eq(['456', '789'])),
|
||||
'status_ids' => be_a(Array).and(eq(%w(456 789))),
|
||||
'created_at' => match_api_datetime_format
|
||||
)
|
||||
end
|
||||
|
@ -18,7 +18,7 @@ RSpec.describe TranslateStatusService do
|
||||
describe '#call' do
|
||||
before do
|
||||
translation_service = TranslationService.new
|
||||
allow(translation_service).to receive(:languages).and_return({ 'en' => ['es', 'es-MX'] })
|
||||
allow(translation_service).to receive(:languages).and_return({ 'en' => %w(es es-MX) })
|
||||
allow(translation_service).to receive(:translate) do |texts|
|
||||
texts.map do |text|
|
||||
TranslationService::Translation.new(
|
||||
|
@ -34,7 +34,7 @@ RSpec.shared_examples 'RankedTrend' do
|
||||
|
||||
it 'returns unique set of languages' do
|
||||
expect(described_class.locales)
|
||||
.to eq(['en', 'es'])
|
||||
.to eq(%w(en es))
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user