Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update RuboCop rules: prefer alias_method #10716

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/services/encryption/user_access_key.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion app/services/proofing/aamva/hmac_secret.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion app/services/x509/attribute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions config/initializers/rack_timeout.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/aws/ses.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def deliver(mail)
response
end

alias deliver! deliver
alias_method :deliver!, :deliver

private

Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/concerns/remember_device_concern_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/support/features/idv_step_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down