Fix `Rails/RootPathnameMethods` cop (#31582)

This commit is contained in:
Matt Jankowski 2024-08-26 03:35:07 -04:00 committed by GitHub
parent 5bcfe8d421
commit bcc4b1078c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 6 additions and 6 deletions

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
Chewy.strategy(:mastodon) do
Dir[Rails.root.join('db', 'seeds', '*.rb')].each do |seed|
Rails.root.glob('db/seeds/*.rb').each do |seed|
load seed
end
end

View File

@ -15,7 +15,7 @@ namespace :branding do
output_dest = Rails.root.join('app', 'javascript', 'images', 'mailer')
# Displayed size is 64px, at 3x it's 192px
Dir[Rails.root.join('app', 'javascript', 'images', 'icons', '*.svg')].each do |path|
Rails.root.glob('app/javascript/images/icons/*.svg').each do |path|
rsvg_convert.run(input: path, size: 192, output: output_dest.join("#{File.basename(path, '.svg')}.png"))
end

View File

@ -20,7 +20,7 @@ end
def find_used_icons
icons_by_weight_and_size = {}
Dir[Rails.root.join('app', 'javascript', '**', '*.*s*')].map do |path|
Rails.root.glob('app/javascript/**/*.*s*').map do |path|
File.open(path, 'r') do |file|
pattern = %r{\Aimport .* from '@/material-icons/(?<weight>[0-9]+)-(?<size>[0-9]+)px/(?<icon>[^-]*)(?<fill>-fill)?.svg\?react';}
file.each_line do |line|

View File

@ -98,7 +98,7 @@ namespace :repo do
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|
locales_in_files = Rails.root.glob('config/locales/*.yml').map do |path|
file_name = File.basename(path, '.yml')
file_name.gsub(/\A(doorkeeper|devise|activerecord|simple_form)\./, '').to_sym
end.uniq.compact

View File

@ -44,7 +44,7 @@ require 'chewy/rspec'
require 'email_spec/rspec'
require 'test_prof/recipes/rspec/before_all'
Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f }
Rails.root.glob('spec/support/**/*.rb').each { |f| require f }
ActiveRecord::Migration.maintain_test_schema!
WebMock.disable_net_connect!(

View File

@ -28,7 +28,7 @@ RSpec.configure do |config|
end
config.after :suite do
FileUtils.rm_rf(Dir[Rails.root.join('spec', 'test_files')])
FileUtils.rm_rf(Rails.root.glob('spec/test_files'))
end
# Use the GitHub Annotations formatter for CI