1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Ignore Style/WordArray in languages_helper

This commit is contained in:
Nick Schonning 2023-11-21 19:09:01 -05:00
parent 00cb4a0313
commit 8e5d65dc3c
No known key found for this signature in database
GPG key ID: 5DDAAD9C9AAFFD9F
5 changed files with 6 additions and 10 deletions

View file

@ -108,10 +108,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,
@ -221,6 +222,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

@ -90,7 +90,7 @@ RSpec.describe User do
it 'preserves valid options for languages' do it 'preserves valid options for languages' do
user = Fabricate.build(:user, chosen_languages: ['en', 'fr', '']) user = Fabricate.build(:user, chosen_languages: ['en', 'fr', ''])
expect(user.chosen_languages).to eq(['en', 'fr']) expect(user.chosen_languages).to eq(%w(en fr))
end end
it 'cleans out empty string from languages' do it 'cleans out empty string from languages' do

View file

@ -42,7 +42,7 @@ RSpec.describe 'Apps' do
client_secret: app.secret, client_secret: app.secret,
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,