Ignore Style/WordArray in languages_helper

This commit is contained in:
Nick Schonning 2023-11-21 19:09:01 -05:00
parent d65e246192
commit 44026b16be
No known key found for this signature in database
GPG Key ID: 5DDAAD9C9AAFFD9F
7 changed files with 8 additions and 12 deletions

View File

@ -103,10 +103,3 @@ Style/RedundantConstantBase:
Exclude: Exclude:
- 'config/environments/production.rb' - 'config/environments/production.rb'
- 'config/initializers/sidekiq.rb' - 'config/initializers/sidekiq.rb'
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: WordRegex.
# SupportedStyles: percent, brackets
Style/WordArray:
EnforcedStyle: percent
MinSize: 3

View File

@ -1,6 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
module LanguagesHelper module LanguagesHelper
# rubocop:disable Style/WordArray
ISO_639_1 = { ISO_639_1 = {
aa: ['Afar', 'Afaraf'].freeze, aa: ['Afar', 'Afaraf'].freeze,
ab: ['Abkhaz', 'аҧсуа бызшәа'].freeze, ab: ['Abkhaz', 'аҧсуа бызшәа'].freeze,
@ -222,6 +223,8 @@ module LanguagesHelper
'zh-YUE': ['Cantonese', '廣東話'].freeze, 'zh-YUE': ['Cantonese', '廣東話'].freeze,
}.freeze }.freeze
# rubocop:enable Style/WordArray
SUPPORTED_LOCALES = {}.merge(ISO_639_1).merge(ISO_639_1_REGIONAL).merge(ISO_639_3).freeze 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 # For ISO-639-1 and ISO-639-3 language codes, we have their official

View File

@ -69,7 +69,7 @@ module Attachmentable
original_extension = Paperclip::Interpolations.extension(attachment, :original) original_extension = Paperclip::Interpolations.extension(attachment, :original)
proper_extension = extensions_for_mime_type.first.to_s proper_extension = extensions_for_mime_type.first.to_s
extension = extensions_for_mime_type.include?(original_extension) ? original_extension : proper_extension 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 extension
end end

View File

@ -45,7 +45,7 @@ RSpec.describe 'Apps' do
client_secret_expires_at: 0, client_secret_expires_at: 0,
name: client_name, name: client_name,
website: website, website: website,
scopes: ['read', 'write'], scopes: %w(read write),
redirect_uris: redirect_uris, redirect_uris: redirect_uris,
# Deprecated properties as of 4.3: # Deprecated properties as of 4.3:
redirect_uri: redirect_uri, redirect_uri: redirect_uri,

View File

@ -12,7 +12,7 @@ RSpec.describe REST::AccountWarningSerializer do
expect(subject) expect(subject)
.to include( .to include(
'id' => be_a(String).and(eq('123')), '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 'created_at' => match_api_datetime_format
) )
end end

View File

@ -18,7 +18,7 @@ RSpec.describe TranslateStatusService do
describe '#call' do describe '#call' do
before do before do
translation_service = TranslationService.new 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| allow(translation_service).to receive(:translate) do |texts|
texts.map do |text| texts.map do |text|
TranslationService::Translation.new( TranslationService::Translation.new(

View File

@ -34,7 +34,7 @@ RSpec.shared_examples 'RankedTrend' do
it 'returns unique set of languages' do it 'returns unique set of languages' do
expect(described_class.locales) expect(described_class.locales)
.to eq(['en', 'es']) .to eq(%w(en es))
end end
end end