From 5134fc65e27522f8d8116bc003ae83d54bf6f2be Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Wed, 12 Jul 2023 04:03:19 -0400 Subject: [PATCH] Fix `Naming/AccessorMethodName` cop (#25924) --- .rubocop_todo.yml | 4 ---- app/controllers/auth/sessions_controller.rb | 2 +- app/controllers/concerns/two_factor_authentication_concern.rb | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 115d496c24..036fa37fa6 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -151,10 +151,6 @@ Metrics/CyclomaticComplexity: Metrics/PerceivedComplexity: Max: 27 -Naming/AccessorMethodName: - Exclude: - - 'app/controllers/auth/sessions_controller.rb' - # Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms. # CheckDefinitionPathHierarchyRoots: lib, spec, test, src # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS diff --git a/app/controllers/auth/sessions_controller.rb b/app/controllers/auth/sessions_controller.rb index 4f59fd501b..1380e6f283 100644 --- a/app/controllers/auth/sessions_controller.rb +++ b/app/controllers/auth/sessions_controller.rb @@ -124,7 +124,7 @@ class Auth::SessionsController < Devise::SessionsController redirect_to new_user_session_path, alert: I18n.t('devise.failure.timeout') end - def set_attempt_session(user) + def register_attempt_in_session(user) session[:attempt_user_id] = user.id session[:attempt_user_updated_at] = user.updated_at.to_s end diff --git a/app/controllers/concerns/two_factor_authentication_concern.rb b/app/controllers/concerns/two_factor_authentication_concern.rb index 94f3ce00f1..9eb45b90d6 100644 --- a/app/controllers/concerns/two_factor_authentication_concern.rb +++ b/app/controllers/concerns/two_factor_authentication_concern.rb @@ -75,7 +75,7 @@ module TwoFactorAuthenticationConcern end def prompt_for_two_factor(user) - set_attempt_session(user) + register_attempt_in_session(user) @body_classes = 'lighter' @webauthn_enabled = user.webauthn_enabled?