From d6f50839e1b208d70ccd07d9fcf75f84a87836d5 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 6 Nov 2023 11:25:40 -0500 Subject: [PATCH] Fix `RSpec/SpecFilePathFormat` cops (#27730) --- .rubocop.yml | 17 +++++++++++------ Gemfile.lock | 8 ++++---- ...fo_controller.rb => node_info_controller.rb} | 0 app/lib/{nodeinfo => node_info}/adapter.rb | 0 .../discovery_serializer.rb | 0 .../{nodeinfo => node_info}/serializer.rb | 0 config/initializers/inflections.rb | 1 - config/routes.rb | 4 ++-- .../attack_spec.rb} | 0 ...ler_spec.rb => node_info_controller_spec.rb} | 0 ...ld_helper_spec.rb => json_ld_helper_spec.rb} | 0 .../config_spec.rb} | 0 12 files changed, 17 insertions(+), 13 deletions(-) rename app/controllers/well_known/{nodeinfo_controller.rb => node_info_controller.rb} (100%) rename app/lib/{nodeinfo => node_info}/adapter.rb (100%) rename app/serializers/{nodeinfo => node_info}/discovery_serializer.rb (100%) rename app/serializers/{nodeinfo => node_info}/serializer.rb (100%) rename spec/config/initializers/{rack_attack_spec.rb => rack/attack_spec.rb} (100%) rename spec/controllers/well_known/{nodeinfo_controller_spec.rb => node_info_controller_spec.rb} (100%) rename spec/helpers/{jsonld_helper_spec.rb => json_ld_helper_spec.rb} (100%) rename spec/lib/{sanitize_config_spec.rb => sanitize/config_spec.rb} (100%) diff --git a/.rubocop.yml b/.rubocop.yml index 63de5e17c7..68352e3198 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -109,16 +109,11 @@ Rails/Exit: # https://docs.rubocop.org/rubocop-rspec/cops_rspec.html#rspecfilepath RSpec/FilePath: CustomTransform: - ActivityPub: activitypub # Ignore the snake_case due to the amount of files to rename + ActivityPub: activitypub DeepL: deepl FetchOEmbedService: fetch_oembed_service - JsonLdHelper: jsonld_helper OEmbedController: oembed_controller OStatus: ostatus - NodeInfoController: nodeinfo_controller # NodeInfo isn't snake_cased for any of the instances - Exclude: - - 'spec/config/initializers/rack_attack_spec.rb' # namespaces usually have separate folder - - 'spec/lib/sanitize_config_spec.rb' # namespaces usually have separate folder # Reason: # https://docs.rubocop.org/rubocop-rspec/cops_rspec.html#rspecnamedsubject @@ -135,6 +130,16 @@ RSpec/NotToNot: RSpec/Rails/HttpStatus: EnforcedStyle: numeric +# Reason: Match overrides from Rspec/FilePath rule above +# https://docs.rubocop.org/rubocop-rspec/cops_rspec.html#rspecspecfilepathformat +RSpec/SpecFilePathFormat: + CustomTransform: + ActivityPub: activitypub + DeepL: deepl + FetchOEmbedService: fetch_oembed_service + OEmbedController: oembed_controller + OStatus: ostatus + # Reason: # https://docs.rubocop.org/rubocop/cops_style.html#styleclassandmodulechildren Style/ClassAndModuleChildren: diff --git a/Gemfile.lock b/Gemfile.lock index 527f032751..560b50cb41 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -659,11 +659,11 @@ GEM rubocop-ast (>= 1.28.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.29.0) + rubocop-ast (1.30.0) parser (>= 3.2.1.0) rubocop-capybara (2.19.0) rubocop (~> 1.41) - rubocop-factory_bot (2.23.1) + rubocop-factory_bot (2.24.0) rubocop (~> 1.33) rubocop-performance (1.19.1) rubocop (>= 1.7.0, < 2.0) @@ -672,8 +672,8 @@ GEM activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) - rubocop-rspec (2.23.2) - rubocop (~> 1.33) + rubocop-rspec (2.25.0) + rubocop (~> 1.40) rubocop-capybara (~> 2.17) rubocop-factory_bot (~> 2.22) ruby-prof (1.6.3) diff --git a/app/controllers/well_known/nodeinfo_controller.rb b/app/controllers/well_known/node_info_controller.rb similarity index 100% rename from app/controllers/well_known/nodeinfo_controller.rb rename to app/controllers/well_known/node_info_controller.rb diff --git a/app/lib/nodeinfo/adapter.rb b/app/lib/node_info/adapter.rb similarity index 100% rename from app/lib/nodeinfo/adapter.rb rename to app/lib/node_info/adapter.rb diff --git a/app/serializers/nodeinfo/discovery_serializer.rb b/app/serializers/node_info/discovery_serializer.rb similarity index 100% rename from app/serializers/nodeinfo/discovery_serializer.rb rename to app/serializers/node_info/discovery_serializer.rb diff --git a/app/serializers/nodeinfo/serializer.rb b/app/serializers/node_info/serializer.rb similarity index 100% rename from app/serializers/nodeinfo/serializer.rb rename to app/serializers/node_info/serializer.rb diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 727a1350d0..3d17509456 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -20,7 +20,6 @@ ActiveSupport::Inflector.inflections(:en) do |inflect| inflect.acronym 'PubSubHubbub' inflect.acronym 'ActivityStreams' inflect.acronym 'JsonLd' - inflect.acronym 'NodeInfo' inflect.acronym 'Ed25519' inflect.acronym 'TOC' inflect.acronym 'RSS' diff --git a/config/routes.rb b/config/routes.rb index ce3fd9596a..3735e42012 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -51,12 +51,12 @@ Rails.application.routes.draw do end get '.well-known/host-meta', to: 'well_known/host_meta#show', as: :host_meta, defaults: { format: 'xml' } - get '.well-known/nodeinfo', to: 'well_known/nodeinfo#index', as: :nodeinfo, defaults: { format: 'json' } + get '.well-known/nodeinfo', to: 'well_known/node_info#index', as: :nodeinfo, defaults: { format: 'json' } get '.well-known/webfinger', to: 'well_known/webfinger#show', as: :webfinger get '.well-known/change-password', to: redirect('/auth/edit') get '.well-known/proxy', to: redirect { |_, request| "/authorize_interaction?#{request.params.to_query}" } - get '/nodeinfo/2.0', to: 'well_known/nodeinfo#show', as: :nodeinfo_schema + get '/nodeinfo/2.0', to: 'well_known/node_info#show', as: :nodeinfo_schema get 'manifest', to: 'manifests#show', defaults: { format: 'json' } get 'intent', to: 'intents#show' diff --git a/spec/config/initializers/rack_attack_spec.rb b/spec/config/initializers/rack/attack_spec.rb similarity index 100% rename from spec/config/initializers/rack_attack_spec.rb rename to spec/config/initializers/rack/attack_spec.rb diff --git a/spec/controllers/well_known/nodeinfo_controller_spec.rb b/spec/controllers/well_known/node_info_controller_spec.rb similarity index 100% rename from spec/controllers/well_known/nodeinfo_controller_spec.rb rename to spec/controllers/well_known/node_info_controller_spec.rb diff --git a/spec/helpers/jsonld_helper_spec.rb b/spec/helpers/json_ld_helper_spec.rb similarity index 100% rename from spec/helpers/jsonld_helper_spec.rb rename to spec/helpers/json_ld_helper_spec.rb diff --git a/spec/lib/sanitize_config_spec.rb b/spec/lib/sanitize/config_spec.rb similarity index 100% rename from spec/lib/sanitize_config_spec.rb rename to spec/lib/sanitize/config_spec.rb