diff --git a/.rubocop.yml b/.rubocop.yml index b949a8fc0e2..029623e039a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1019,6 +1019,10 @@ Security/YAMLLoad: Enabled: true SafeAutoCorrect: false +Style/Alias: + Enabled: true + EnforcedStyle: prefer_alias_method + Style/AndOr: Description: Use &&/|| instead of and/or. StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-and-or-or diff --git a/app/services/encryption/user_access_key.rb b/app/services/encryption/user_access_key.rb index 854ba65e65d..f3b9363c7e5 100644 --- a/app/services/encryption/user_access_key.rb +++ b/app/services/encryption/user_access_key.rb @@ -53,7 +53,7 @@ def unlock(encryption_key_arg) def unlocked? cek.present? end - alias built? unlocked? + alias_method :built?, :unlocked? def encryption_key Base64.strict_encode64(masked_ciphertext) diff --git a/app/services/proofing/aamva/hmac_secret.rb b/app/services/proofing/aamva/hmac_secret.rb index a1e7926b743..44b76403979 100644 --- a/app/services/proofing/aamva/hmac_secret.rb +++ b/app/services/proofing/aamva/hmac_secret.rb @@ -27,7 +27,7 @@ class HmacSecret attr_reader :client_secret, :server_secret, :psha1 - alias secret client_secret + alias_method :secret, :client_secret def initialize(encoded_client_secret, encoded_server_secret) @client_secret = Base64.decode64(encoded_client_secret) diff --git a/app/services/x509/attribute.rb b/app/services/x509/attribute.rb index 7b9c4bce214..aaf1bbaa6c5 100644 --- a/app/services/x509/attribute.rb +++ b/app/services/x509/attribute.rb @@ -13,6 +13,6 @@ def initialize(raw: nil, norm: nil) end delegate :blank?, :present?, :to_s, :to_date, :==, :eql?, to: :raw - alias to_str to_s + alias_method :to_str, :to_s end end diff --git a/config/initializers/rack_timeout.rb b/config/initializers/rack_timeout.rb index 201e24f311a..ef16577cfa8 100644 --- a/config/initializers/rack_timeout.rb +++ b/config/initializers/rack_timeout.rb @@ -21,8 +21,8 @@ def call_with_excludes(env) end end - alias call_without_excludes call - alias call call_with_excludes + alias_method :call_without_excludes, :call + alias_method :call, :call_with_excludes end end diff --git a/lib/aws/ses.rb b/lib/aws/ses.rb index 032a93c1964..8ce634e0964 100644 --- a/lib/aws/ses.rb +++ b/lib/aws/ses.rb @@ -18,7 +18,7 @@ def deliver(mail) response end - alias deliver! deliver + alias_method :deliver!, :deliver private diff --git a/spec/controllers/concerns/remember_device_concern_spec.rb b/spec/controllers/concerns/remember_device_concern_spec.rb index 6c6ecfc13ba..7c05ff31bae 100644 --- a/spec/controllers/concerns/remember_device_concern_spec.rb +++ b/spec/controllers/concerns/remember_device_concern_spec.rb @@ -11,8 +11,8 @@ include(RememberDeviceConcern) attr_reader :sp, :raw_session, :request, :current_user - alias :sp_from_sp_session :sp - alias :sp_session :raw_session + alias_method :sp_from_sp_session, :sp + alias_method :sp_session, :raw_session def initialize(sp, raw_session, request, current_user) @sp = sp diff --git a/spec/support/features/idv_step_helper.rb b/spec/support/features/idv_step_helper.rb index cc76166a271..527fd63cc1b 100644 --- a/spec/support/features/idv_step_helper.rb +++ b/spec/support/features/idv_step_helper.rb @@ -96,8 +96,8 @@ def complete_idv_steps_with_phone_before_confirmation_step(user = user_with_2fa) complete_enter_password_step(user) end - alias complete_idv_steps_before_enter_password_step - complete_idv_steps_with_phone_before_enter_password_step + alias_method :complete_idv_steps_before_enter_password_step, + :complete_idv_steps_with_phone_before_enter_password_step def complete_idv_steps_with_gpo_before_enter_password_step(user = user_with_2fa) complete_idv_steps_before_gpo_step(user)