diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 03cc2e75d..c323aa877 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -386,14 +386,6 @@ Style/InverseMethods: - 'app/services/update_account_service.rb' - 'spec/controllers/activitypub/replies_controller_spec.rb' -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: line_count_dependent, lambda, literal -Style/Lambda: - Exclude: - - 'config/initializers/simple_form.rb' - - 'config/routes.rb' - # This cop supports unsafe autocorrection (--autocorrect-all). Style/MapToHash: Exclude: diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb index 6d9d7b8ae..a8bc4b192 100644 --- a/config/initializers/simple_form.rb +++ b/config/initializers/simple_form.rb @@ -164,7 +164,7 @@ SimpleForm.setup do |config| # config.item_wrapper_class = nil # How the label text should be generated altogether with the required text. - config.label_text = lambda { |label, required, _explicit_label| "#{label} #{required}" } + config.label_text = ->(label, required, _explicit_label) { "#{label} #{required}" } # You can define the class to use on all labels. Default is nil. # config.label_class = nil diff --git a/config/routes.rb b/config/routes.rb index 150b26cf1..85c3b1855 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -51,7 +51,7 @@ Rails.application.routes.draw do get 'health', to: 'health#show' - authenticate :user, lambda { |u| u.role&.can?(:view_devops) } do + authenticate :user, ->(user) { user.role&.can?(:view_devops) } do mount Sidekiq::Web, at: 'sidekiq', as: :sidekiq mount PgHero::Engine, at: 'pghero', as: :pghero end @@ -105,10 +105,10 @@ Rails.application.routes.draw do } # rubocop:disable Style/FormatStringToken - those do not go through the usual formatting functions and are not safe to correct - get '/users/:username', to: redirect_with_vary('/@%{username}'), constraints: lambda { |req| req.format.nil? || req.format.html? } - get '/users/:username/following', to: redirect_with_vary('/@%{username}/following'), constraints: lambda { |req| req.format.nil? || req.format.html? } - get '/users/:username/followers', to: redirect_with_vary('/@%{username}/followers'), constraints: lambda { |req| req.format.nil? || req.format.html? } - get '/users/:username/statuses/:id', to: redirect_with_vary('/@%{username}/%{id}'), constraints: lambda { |req| req.format.nil? || req.format.html? } + get '/users/:username', to: redirect_with_vary('/@%{username}'), constraints: ->(req) { req.format.nil? || req.format.html? } + get '/users/:username/following', to: redirect_with_vary('/@%{username}/following'), constraints: ->(req) { req.format.nil? || req.format.html? } + get '/users/:username/followers', to: redirect_with_vary('/@%{username}/followers'), constraints: ->(req) { req.format.nil? || req.format.html? } + get '/users/:username/statuses/:id', to: redirect_with_vary('/@%{username}/%{id}'), constraints: ->(req) { req.format.nil? || req.format.html? } # rubocop:enable Style/FormatStringToken get '/authorize_follow', to: redirect { |_, request| "/authorize_interaction?#{request.params.to_query}" }