Skip to content
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 @@ -641,6 +641,10 @@ Naming/HeredocDelimiterCase:
Enabled: true
EnforcedStyle: uppercase

Naming/MemoizedInstanceVariableName:
Enabled: true
EnforcedStyleForLeadingUnderscores: disallowed

Naming/MethodParameterName:
MinNameLength: 2

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/account_reset/pending_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def confirm_account_reset_request_exists
end

def pending_account_reset_request
@account_reset_request ||= AccountReset::FindPendingRequestForUser.new(
@pending_account_reset_request ||= AccountReset::FindPendingRequestForUser.new(
current_user,
).call
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def user_event_creator
delegate :remember_device_default, to: :decorated_session

def decorated_session
@_decorated_session ||= DecoratedSession.new(
@decorated_session ||= DecoratedSession.new(
sp: current_sp,
view_context: view_context,
sp_session: sp_session,
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/concerns/account_reactivation_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def confirm_password_reset_profile
end

def reactivate_account_session
@_reactivate_account_session ||= ReactivateAccountSession.new(
@reactivate_account_session ||= ReactivateAccountSession.new(
user: current_user,
user_session: user_session,
)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/concerns/idv_session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def confirm_idv_vendor_session_started
end

def idv_session
@_idv_session ||= Idv::Session.new(
@idv_session ||= Idv::Session.new(
user_session: user_session,
current_user: effective_user,
issuer: sp_session[:issuer],
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/concerns/saml_idp_auth_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,12 @@ def saml_response_signature_options
end

def current_service_provider
return @_sp if defined?(@_sp)
@_sp = ServiceProvider.find_by(issuer: current_issuer)
return @current_service_provider if defined?(@current_service_provider)
@current_service_provider = ServiceProvider.find_by(issuer: current_issuer)
end

def current_issuer
@_issuer ||= saml_request.service_provider&.identifier
@current_issuer ||= saml_request.service_provider&.identifier
end

def request_url
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def device_and_events
end

def device_id
@device_id_param ||= begin
@device_id ||= begin
id = params[:id].try(:to_i)
id || 0
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/idv/gpo_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def update
end

def gpo_mail_service
@_gpo_mail_service ||= Idv::GpoMail.new(current_user)
@gpo_mail_service ||= Idv::GpoMail.new(current_user)
end

private
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/idv/otp_delivery_method_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ def otp_delivery_selection_form
end

def gpo_letter_available
@_gpo_letter_available ||= FeatureManagement.enable_gpo_verification? &&
!Idv::GpoMail.new(current_user).mail_spammed?
@gpo_letter_available ||= FeatureManagement.enable_gpo_verification? &&
!Idv::GpoMail.new(current_user).mail_spammed?
end
end
end
8 changes: 4 additions & 4 deletions app/controllers/idv/phone_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def step_name
end

def step
@_step ||= Idv::PhoneStep.new(idv_session: idv_session, trace_id: amzn_trace_id)
@step ||= Idv::PhoneStep.new(idv_session: idv_session, trace_id: amzn_trace_id)
end

def step_params
Expand All @@ -93,7 +93,7 @@ def confirm_step_needed
end

def set_idv_form
@idv_form ||= Idv::PhoneForm.new(
@idv_form = Idv::PhoneForm.new(
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed memoization because this is a before filter, so it's always called

user: current_user,
previous_params: idv_session.previous_phone_step_params,
allowed_countries: ['US'],
Expand Down Expand Up @@ -127,8 +127,8 @@ def async_state_done(async_state)
end

def gpo_letter_available
@_gpo_letter_available ||= FeatureManagement.enable_gpo_verification? &&
!Idv::GpoMail.new(current_user).mail_spammed?
@gpo_letter_available ||= FeatureManagement.enable_gpo_verification? &&
!Idv::GpoMail.new(current_user).mail_spammed?
end
end
end
2 changes: 1 addition & 1 deletion app/controllers/redirect/return_to_sp_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def sp_return_url_resolver
end

def sp_request_params
@request_params ||= begin
@sp_request_params ||= begin
if sp_request_url.present?
UriService.params(sp_request_url)
else
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/sign_up/completions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,11 @@ def track_completion_event(last_page)
analytics.track_event(Analytics::USER_REGISTRATION_COMPLETE, analytics_attributes(last_page))
end

# rubocop:disable Naming/MemoizedInstanceVariableName
def pii
@parsed_pii ||= JSON.parse(user_session['decrypted_pii']).symbolize_keys
end
# rubocop:enable Naming/MemoizedInstanceVariableName

def address
addr = pii[:address2]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ def re_encrypt_profile_recovery_pii
end

def password_reset_profile
@_password_reset_profile ||= current_user.decorate.password_reset_profile
@password_reset_profile ||= current_user.decorate.password_reset_profile
end

def pii
@_pii ||= password_reset_profile.recover_pii(normalized_personal_key)
@pii ||= password_reset_profile.recover_pii(normalized_personal_key)
end

def personal_key_param
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def redirect_to_piv_cac_service
private

def process_token
result = piv_cac_verfication_form.submit
result = piv_cac_verification_form.submit
analytics.track_mfa_submit_event(
result.to_h.merge(analytics_properties),
)
Expand All @@ -40,8 +40,8 @@ def process_token
def handle_valid_piv_cac
clear_piv_cac_nonce
save_piv_cac_information(
subject: piv_cac_verfication_form.x509_dn,
issuer: piv_cac_verfication_form.x509_issuer,
subject: piv_cac_verification_form.x509_dn,
issuer: piv_cac_verification_form.x509_issuer,
presented: true,
)

Expand Down Expand Up @@ -72,7 +72,7 @@ def piv_cac_view_data
}.merge(generic_data)
end

def piv_cac_verfication_form
def piv_cac_verification_form
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏🏼

@piv_cac_verification_form ||= UserPivCacVerificationForm.new(
user: current_user,
token: params[:token],
Expand All @@ -99,7 +99,7 @@ def analytics_properties
{
context: context,
multi_factor_auth_method: 'piv_cac',
piv_cac_configuration_id: piv_cac_verfication_form&.piv_cac_configuration&.id,
piv_cac_configuration_id: piv_cac_verification_form&.piv_cac_configuration&.id,
}
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/users/reset_passwords_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def user_matching_token(token)
end

def token_user
@_token_user ||= User.with_reset_password_token(params[:reset_password_token])
@token_user ||= User.with_reset_password_token(params[:reset_password_token])
end

def build_user
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/users/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def handle_valid_authentication
end

def now
@_now ||= Time.zone.now
@now ||= Time.zone.now
end

def update_sp_return_logs_with_user(user_id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def phone_to_deliver_to
end

def otp_rate_limiter
@_otp_rate_limited ||= OtpRateLimiter.new(
@otp_rate_limiter ||= OtpRateLimiter.new(
phone: phone_to_deliver_to,
user: current_user,
phone_confirmed: UserSessionContext.authentication_context?(context),
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/users/verify_password_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ def confirm_personal_key
redirect_to root_url
end

# rubocop:disable Naming/MemoizedInstanceVariableName
# @return [Pii::Attributes, nil]
def decrypted_pii
@_decrypted_pii ||= reactivate_account_session.decrypted_pii
end
# rubocop:enable Naming/MemoizedInstanceVariableName

def handle_success(result)
flash[:personal_key] = result.extra[:personal_key]
Expand Down
2 changes: 1 addition & 1 deletion app/decorators/user_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def lockout_period
end

def lockout_period_config
@config ||= IdentityConfig.store.lockout_period_in_minutes
@lockout_period_config ||= IdentityConfig.store.lockout_period_in_minutes
end

def lockout_period_expired?
Expand Down
2 changes: 1 addition & 1 deletion app/forms/add_user_email_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ def extra_analytics_attributes
end

def existing_user
@_user ||= User.find_with_email(email) || AnonymousUser.new
@existing_user ||= User.find_with_email(email) || AnonymousUser.new
end
end
2 changes: 1 addition & 1 deletion app/forms/gpo_verify_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def submit
protected

def pending_profile
@_pending_profile ||= user.pending_profile
@pending_profile ||= user.pending_profile
end

def gpo_confirmation_code
Expand Down
2 changes: 1 addition & 1 deletion app/forms/otp_delivery_selection_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def extra_analytics_attributes
end

def parsed_phone
@_parsed_phone ||= Phonelib.parse(phone)
@parsed_phone ||= Phonelib.parse(phone)
end

def confirmed_phone?
Expand Down
2 changes: 1 addition & 1 deletion app/forms/password_reset_email_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ def extra_analytics_attributes
end

def user
@_user ||= User.find_with_email(email)
@user ||= User.find_with_email(email)
end
end
2 changes: 1 addition & 1 deletion app/forms/register_user_email_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def user_unconfirmed?
end

def existing_user
@_user ||= User.find_with_email(email) || AnonymousUser.new
@existing_user ||= User.find_with_email(email) || AnonymousUser.new
end

def email_request_id(request_id)
Expand Down
2 changes: 1 addition & 1 deletion app/forms/update_user_password_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ def encrypt_user_profile_if_active
end

def encryptor
@_encryptor ||= ActiveProfileEncryptor.new(user, user_session, password)
@encryptor ||= ActiveProfileEncryptor.new(user, user_session, password)
end
end
2 changes: 1 addition & 1 deletion app/forms/verify_password_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ def reencrypt_pii
end

def profile
@_profile ||= user.decorate.password_reset_profile
@profile ||= user.decorate.password_reset_profile
end
end
2 changes: 1 addition & 1 deletion app/forms/verify_personal_key_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def submit

# @return [Pii::Attributes,nil]
def decrypted_pii
@_pii ||= password_reset_profile.recover_pii(personal_key)
@decrypted_pii ||= password_reset_profile.recover_pii(personal_key)
end

private
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/encryptable_attribute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def encrypted_attribute_without_setter(name:)
private

def encrypted_attributes
@_encrypted_attributes ||= {}
@encrypted_attributes ||= {}
end

def get_encrypted_attribute(name:)
Expand Down
2 changes: 1 addition & 1 deletion app/models/federated_protocols/saml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def aal
end

def requested_attributes
@_attributes ||= SamlRequestPresenter.new(
@requested_attributes ||= SamlRequestPresenter.new(
request: request, service_provider: current_service_provider,
).requested_attributes
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def includes_liveness_check?
private

def personal_key_generator
@_personal_key_generator ||= PersonalKeyGenerator.new(user)
@personal_key_generator ||= PersonalKeyGenerator.new(user)
end

def encrypt_ssn_fingerprint(pii)
Expand Down
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def active_identities
end

def active_profile
@_active_profile ||= profiles.verified.find(&:active?)
@active_profile ||= profiles.verified.find(&:active?)
end

def pending_profile?
Expand Down
2 changes: 1 addition & 1 deletion app/presenters/saml_request_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def authn_context
end

def bundle
@_bundle ||= (
@bundle ||= (
authn_request_bundle || service_provider&.attribute_bundle || []
).map(&:to_sym)
end
Expand Down
2 changes: 1 addition & 1 deletion app/services/attribute_asserter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def add_all_emails(attrs)
end

def bundle
@_bundle ||= (
@bundle ||= (
authn_request_bundle || service_provider.metadata[:attribute_bundle] || []
).map(&:to_sym)
end
Expand Down
2 changes: 1 addition & 1 deletion app/services/data_requests/lookup_shared_device_users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def lookup_user(user)
end

def looked_up_user_uuids
@looked_up_users ||= Set.new
@looked_up_user_uuids ||= Set.new
end

def users_to_lookup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def processed_alerts
end

def processed_image_metrics
@image_metrics ||= raw_images_data.index_by do |image|
@processed_image_metrics ||= raw_images_data.index_by do |image|
image.delete('Uri')
get_image_side_name(image['Side'])
end
Expand Down
Loading