Enable Rubocop Rails/FilePath (#23854)

pull/2215/head
Nick Schonning 2023-05-03 23:50:40 -04:00 committed by GitHub
parent c97b611b6b
commit 1fe04f740a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 72 deletions

View File

@ -161,6 +161,11 @@ Metrics/MethodLength:
Metrics/ModuleLength: Metrics/ModuleLength:
CountAsOne: [array, heredoc] CountAsOne: [array, heredoc]
# Reason: Prevailing style is argument file paths
# https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsfilepath
Rails/FilePath:
EnforcedStyle: arguments
# Reason: Prevailing style uses numeric status codes, matches RSpec/Rails/HttpStatus # Reason: Prevailing style uses numeric status codes, matches RSpec/Rails/HttpStatus
# https://docs.rubocop.org/rubocop-rails/cops_rails.html#railshttpstatus # https://docs.rubocop.org/rubocop-rails/cops_rails.html#railshttpstatus
Rails/HttpStatus: Rails/HttpStatus:

View File

@ -822,73 +822,6 @@ Rails/Exit:
Exclude: Exclude:
- 'config/boot.rb' - 'config/boot.rb'
# Configuration parameters: EnforcedStyle.
# SupportedStyles: slashes, arguments
Rails/FilePath:
Exclude:
- 'app/lib/themes.rb'
- 'app/models/setting.rb'
- 'app/validators/reaction_validator.rb'
- 'config/environments/test.rb'
- 'db/migrate/20170716191202_add_hide_notifications_to_mute.rb'
- 'db/migrate/20171005171936_add_disabled_to_custom_emojis.rb'
- 'db/migrate/20171028221157_add_reblogs_to_follows.rb'
- 'db/migrate/20171107143332_add_memorial_to_accounts.rb'
- 'db/migrate/20171107143624_add_disabled_to_users.rb'
- 'db/migrate/20171109012327_add_moderator_to_accounts.rb'
- 'db/migrate/20171130000000_add_embed_url_to_preview_cards.rb'
- 'db/migrate/20180615122121_add_autofollow_to_invites.rb'
- 'db/migrate/20180707154237_add_whole_word_to_custom_filter.rb'
- 'db/migrate/20180814171349_add_confidential_to_doorkeeper_application.rb'
- 'db/migrate/20181010141500_add_silent_to_mentions.rb'
- 'db/migrate/20181017170937_add_reject_reports_to_domain_blocks.rb'
- 'db/migrate/20181018205649_add_unread_to_account_conversations.rb'
- 'db/migrate/20181127130500_identity_id_to_bigint.rb'
- 'db/migrate/20181127165847_add_show_replies_to_lists.rb'
- 'db/migrate/20190201012802_add_overwrite_to_imports.rb'
- 'db/migrate/20190306145741_add_lock_version_to_polls.rb'
- 'db/migrate/20190307234537_add_approved_to_users.rb'
- 'db/migrate/20191001213028_add_lock_version_to_account_stats.rb'
- 'db/migrate/20191212003415_increase_backup_size.rb'
- 'db/migrate/20200312144258_add_title_to_account_warning_presets.rb'
- 'db/migrate/20200620164023_add_fixed_lowercase_index_to_accounts.rb'
- 'db/migrate/20200917192924_add_notify_to_follows.rb'
- 'db/migrate/20201218054746_add_obfuscate_to_domain_blocks.rb'
- 'db/migrate/20210421121431_add_case_insensitive_btree_index_to_tags.rb'
- 'db/migrate/20211231080958_add_category_to_reports.rb'
- 'db/migrate/20220613110834_add_action_to_custom_filters.rb'
- 'db/post_migrate/20220307083603_optimize_null_index_conversations_uri.rb'
- 'db/post_migrate/20220310060545_optimize_null_index_statuses_in_reply_to_account_id.rb'
- 'db/post_migrate/20220310060556_optimize_null_index_statuses_in_reply_to_id.rb'
- 'db/post_migrate/20220310060614_optimize_null_index_media_attachments_scheduled_status_id.rb'
- 'db/post_migrate/20220310060626_optimize_null_index_media_attachments_shortcode.rb'
- 'db/post_migrate/20220310060641_optimize_null_index_users_reset_password_token.rb'
- 'db/post_migrate/20220310060653_optimize_null_index_users_created_by_application_id.rb'
- 'db/post_migrate/20220310060706_optimize_null_index_statuses_uri.rb'
- 'db/post_migrate/20220310060722_optimize_null_index_accounts_moved_to_account_id.rb'
- 'db/post_migrate/20220310060740_optimize_null_index_oauth_access_tokens_refresh_token.rb'
- 'db/post_migrate/20220310060750_optimize_null_index_accounts_url.rb'
- 'db/post_migrate/20220310060809_optimize_null_index_oauth_access_tokens_resource_owner_id.rb'
- 'db/post_migrate/20220310060833_optimize_null_index_announcement_reactions_custom_emoji_id.rb'
- 'db/post_migrate/20220310060854_optimize_null_index_appeals_approved_by_account_id.rb'
- 'db/post_migrate/20220310060913_optimize_null_index_account_migrations_target_account_id.rb'
- 'db/post_migrate/20220310060926_optimize_null_index_appeals_rejected_by_account_id.rb'
- 'db/post_migrate/20220310060939_optimize_null_index_list_accounts_follow_id.rb'
- 'db/post_migrate/20220310060959_optimize_null_index_web_push_subscriptions_access_token_id.rb'
- 'db/post_migrate/20220613110802_remove_whole_word_from_custom_filters.rb'
- 'db/post_migrate/20220613110903_remove_irreversible_from_custom_filters.rb'
- 'db/post_migrate/20220617202502_migrate_roles.rb'
- 'db/seeds.rb'
- 'db/seeds/03_roles.rb'
- 'lib/tasks/branding.rake'
- 'lib/tasks/emojis.rake'
- 'lib/tasks/repo.rake'
- 'spec/controllers/admin/custom_emojis_controller_spec.rb'
- 'spec/fabricators/custom_emoji_fabricator.rb'
- 'spec/fabricators/site_upload_fabricator.rb'
- 'spec/rails_helper.rb'
- 'spec/spec_helper.rb'
# Configuration parameters: Include. # Configuration parameters: Include.
# Include: app/models/**/*.rb # Include: app/models/**/*.rb
Rails/HasAndBelongsToMany: Rails/HasAndBelongsToMany:

View File

@ -14,7 +14,7 @@ Rails.application.configure do
# Enable/disable caching. By default caching is disabled. # Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching. # Run rails dev:cache to toggle caching.
if Rails.root.join('tmp/caching-dev.txt').exist? if Rails.root.join('tmp', 'caching-dev.txt').exist?
config.action_controller.perform_caching = true config.action_controller.perform_caching = true
config.cache_store = :redis_cache_store, REDIS_CACHE_PARAMS config.cache_store = :redis_cache_store, REDIS_CACHE_PARAMS
else else

View File

@ -59,7 +59,7 @@ Rails.application.configure do
end end
end end
Paperclip::Attachment.default_options[:path] = "#{Rails.root}/spec/test_files/:class/:id_partition/:style.:extension" Paperclip::Attachment.default_options[:path] = Rails.root.join('spec', 'test_files', ':class', ':id_partition', ':style.:extension')
# set fake_data for pam, don't do real calls, just use fake data # set fake_data for pam, don't do real calls, just use fake data
if ENV['PAM_ENABLED'] == 'true' if ENV['PAM_ENABLED'] == 'true'

View File

@ -12,7 +12,7 @@ require 'paperclip/matchers'
require 'capybara/rspec' require 'capybara/rspec'
require 'chewy/rspec' require 'chewy/rspec'
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f } Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f }
ActiveRecord::Migration.maintain_test_schema! ActiveRecord::Migration.maintain_test_schema!
WebMock.disable_net_connect!(allow: Chewy.settings[:host]) WebMock.disable_net_connect!(allow: Chewy.settings[:host])
@ -56,7 +56,7 @@ module SignedRequestHelpers
end end
RSpec.configure do |config| RSpec.configure do |config|
config.fixture_path = "#{Rails.root}/spec/fixtures" config.fixture_path = Rails.root.join('spec', 'fixtures')
config.use_transactional_fixtures = true config.use_transactional_fixtures = true
config.order = 'random' config.order = 'random'
config.infer_spec_type_from_file_location! config.infer_spec_type_from_file_location!

View File

@ -38,7 +38,7 @@ RSpec.configure do |config|
config.after :suite do config.after :suite do
gc_counter = 0 gc_counter = 0
FileUtils.rm_rf(Dir["#{Rails.root}/spec/test_files/"]) FileUtils.rm_rf(Dir[Rails.root.join('spec', 'test_files')])
end end
config.after :each do config.after :each do