From 56c0babc0bacf6f8e87c126e98966f0afa6ab467 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 28 Sep 2023 09:48:47 -0400 Subject: [PATCH] Fix rubocop `Layout/ArgumentAlignment` cop (#26060) --- .rubocop_todo.yml | 9 -------- config/initializers/cors.rb | 32 ++++++++++------------------ config/initializers/session_store.rb | 11 ++++++---- 3 files changed, 18 insertions(+), 34 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index adfd47689..efe369d77 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -13,14 +13,6 @@ Bundler/OrderedGems: Exclude: - 'Gemfile' -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, IndentationWidth. -# SupportedStyles: with_first_argument, with_fixed_indentation -Layout/ArgumentAlignment: - Exclude: - - 'config/initializers/cors.rb' - - 'config/initializers/session_store.rb' - # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle. # SupportedHashRocketStyles: key, separator, table @@ -841,6 +833,5 @@ Style/TrailingCommaInHashLiteral: Style/WordArray: Exclude: - 'app/helpers/languages_helper.rb' - - 'config/initializers/cors.rb' - 'spec/controllers/settings/imports_controller_spec.rb' - 'spec/models/form/import_spec.rb' diff --git a/config/initializers/cors.rb b/config/initializers/cors.rb index 1fde35f9d..3d94e38e8 100644 --- a/config/initializers/cors.rb +++ b/config/initializers/cors.rb @@ -11,26 +11,16 @@ Rails.application.config.middleware.insert_before 0, Rack::Cors do allow do origins '*' - resource '/.well-known/*', - headers: :any, - methods: [:get], - credentials: false - resource '/@:username', - headers: :any, - methods: [:get], - credentials: false - resource '/users/:username', - headers: :any, - methods: [:get], - credentials: false - resource '/api/*', - headers: :any, - methods: [:post, :put, :delete, :get, :patch, :options], - credentials: false, - expose: ['Link', 'X-RateLimit-Reset', 'X-RateLimit-Limit', 'X-RateLimit-Remaining', 'X-Request-Id'] - resource '/oauth/token', - headers: :any, - methods: [:post], - credentials: false + with_options headers: :any, credentials: false do + with_options methods: [:get] do + resource '/.well-known/*' + resource '/@:username' + resource '/users/:username' + end + resource '/api/*', + expose: %w(Link X-RateLimit-Reset X-RateLimit-Limit X-RateLimit-Remaining X-Request-Id), + methods: %i(post put delete get patch options) + resource '/oauth/token', methods: [:post] + end end end diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index b29e0a815..eac23a79b 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -2,7 +2,10 @@ # Be sure to restart your server when you modify this file. -Rails.application.config.session_store :cookie_store, - key: '_mastodon_session', - secure: false, # All cookies have their secure flag set by the force_ssl option in production - same_site: :lax +Rails + .application + .config + .session_store :cookie_store, + key: '_mastodon_session', + secure: false, # All cookies have their secure flag set by the force_ssl option in production + same_site: :lax