From 8fd3fc404dd848253767252bbd76275e091832b1 Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Tue, 21 Feb 2023 19:57:15 -0500 Subject: Autofix Rubocop Rails/RootPathnameMethods (#23760) --- lib/tasks/repo.rake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/tasks/repo.rake') diff --git a/lib/tasks/repo.rake b/lib/tasks/repo.rake index 795b54c59..5d1b4f754 100644 --- a/lib/tasks/repo.rake +++ b/lib/tasks/repo.rake @@ -5,7 +5,7 @@ REPOSITORY_NAME = 'mastodon/mastodon' namespace :repo do desc 'Generate the AUTHORS.md file' task :authors do - file = File.open(Rails.root.join('AUTHORS.md'), 'w') + file = Rails.root.join('AUTHORS.md').open('w') file << <<~HEADER Authors @@ -87,8 +87,8 @@ namespace :repo do task check_locales_files: :environment do pastel = Pastel.new - missing_yaml_files = I18n.available_locales.reject { |locale| File.exist?(Rails.root.join('config', 'locales', "#{locale}.yml")) } - missing_json_files = I18n.available_locales.reject { |locale| File.exist?(Rails.root.join('app', 'javascript', 'mastodon', 'locales', "#{locale}.json")) } + missing_yaml_files = I18n.available_locales.reject { |locale| Rails.root.join('config', 'locales', "#{locale}.yml").exist? } + missing_json_files = I18n.available_locales.reject { |locale| Rails.root.join('app', 'javascript', 'mastodon', 'locales', "#{locale}.json").exist? } locales_in_files = Dir[Rails.root.join('config', 'locales', '*.yml')].map do |path| file_name = File.basename(path) -- cgit From e762a14c0ab235c337b3cddbef1eaf72b26faf58 Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Sun, 12 Mar 2023 19:03:07 -0400 Subject: Enable Rubocop Performance/DeleteSuffix (#24077) --- .rubocop_todo.yml | 7 ------- lib/tasks/repo.rake | 4 ++-- 2 files changed, 2 insertions(+), 9 deletions(-) (limited to 'lib/tasks/repo.rake') diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index a9727f939..8a96e59f9 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -301,13 +301,6 @@ Performance/DeletePrefix: - 'app/services/resolve_account_service.rb' - 'app/services/tag_search_service.rb' -# Offense count: 1 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: SafeMultiline. -Performance/DeleteSuffix: - Exclude: - - 'lib/tasks/repo.rake' - # Offense count: 19 # This cop supports unsafe autocorrection (--autocorrect-all). Performance/MapCompact: diff --git a/lib/tasks/repo.rake b/lib/tasks/repo.rake index 5d1b4f754..888337b4f 100644 --- a/lib/tasks/repo.rake +++ b/lib/tasks/repo.rake @@ -91,8 +91,8 @@ namespace :repo do missing_json_files = I18n.available_locales.reject { |locale| Rails.root.join('app', 'javascript', 'mastodon', 'locales', "#{locale}.json").exist? } locales_in_files = Dir[Rails.root.join('config', 'locales', '*.yml')].map do |path| - file_name = File.basename(path) - file_name.gsub(/\A(doorkeeper|devise|activerecord|simple_form)\./, '').gsub(/\.yml\z/, '').to_sym + file_name = File.basename(path, '.yml') + file_name.gsub(/\A(doorkeeper|devise|activerecord|simple_form)\./, '').to_sym end.uniq.compact missing_available_locales = locales_in_files - I18n.available_locales -- cgit