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
2 changes: 2 additions & 0 deletions .erb-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ linters:
Enabled: false
Rails/OutputSafety:
Enabled: false
Lint/UselessAssignment:
Enabled: false
DeprecatedClasses:
enabled: true
rule_set:
Expand Down
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,9 @@ Lint/UriEscapeUnescape:
Lint/UriRegexp:
Enabled: true

Lint/UselessAssignment:
Enabled: true

Lint/UselessElseWithoutRescue:
Enabled: true

Expand Down
2 changes: 1 addition & 1 deletion app/services/analytics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def register_doc_auth_step_from_analytics_event(event, attributes)

def track_mfa_submit_event(attributes)
track_event(MULTI_FACTOR_AUTH, attributes)
mfa_event_type = (attributes[:success] ? 'success' : 'fail')
attributes[:success] ? 'success' : 'fail'
end

attr_reader :user, :request, :sp, :ahoy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def full_month_subquery(issuer:, full_months:)
year_months: full_months.map { |r| r.begin.strftime('%Y%m') },
}.transform_values { |value| quote(value) }

full_month_subquery = format(<<~SQL, params)
format(<<~SQL, params)
SELECT
monthly_sp_auth_counts.user_id
, monthly_sp_auth_counts.year_month
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def full_month_subquery(issuers:, full_months:)
year_months: full_months.map { |r| r.begin.strftime('%Y%m') },
}.transform_values { |value| quote(value) }

full_month_subquery = format(<<~SQL, params)
format(<<~SQL, params)
SELECT
monthly_sp_auth_counts.user_id
, monthly_sp_auth_counts.year_month
Expand Down
2 changes: 1 addition & 1 deletion app/services/piv_cac_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def token_response(token)
) do |req|
req.options.context = { service_name: 'piv_cac_token' }
end
rescue Faraday::ConnectionFailed, Faraday::TimeoutError => e
rescue Faraday::ConnectionFailed, Faraday::TimeoutError
nil
end

Expand Down
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class Application < Rails::Application
# see config/initializers/job_configurations.rb for cron schedule

includes_star_queue = config.good_job.queues.split(';').any? do |name_threads|
name, threads = name_threads.split(':', 2)
name, _threads = name_threads.split(':', 2)
name == '*'
end
raise 'good_job.queues does not contain *, but it should' if !includes_star_queue
Expand Down
3 changes: 0 additions & 3 deletions config/initializers/job_configurations.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
cron_5m = '0/5 * * * *'
interval_5m = 5 * 60
cron_1h = '0 * * * *'
interval_1h = 60 * 60
cron_24h = '0 0 * * *'
gpo_cron_24h = '0 10 * * *' # 10am UTC is 5am EST/6am EDT
inteval_24h = 24 * 60 * 60

if defined?(Rails::Console)
Rails.logger.info 'job_configurations: console detected, skipping schedule'
Expand Down
2 changes: 0 additions & 2 deletions lib/analytics_events_documenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ def missing_documentation
# @return [{ events: Array<Hash>}]
def as_json
events_json_summary = analytics_methods.map do |method_object|
param_names = method_object.parameters.map { |p| p.first.chomp(':') }

attributes = method_object.tags('param').map do |tag|
{
name: tag.name,
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/newrelic.rake
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ namespace :newrelic do
task deployment: :environment do
require 'new_relic/cli/command'
revision = `git rev-parse HEAD`.chomp
NewRelic::Cli::Deployments.new(revision: `git rev-parse HEAD`).run
NewRelic::Cli::Deployments.new(revision: revision).run
end
end
7 changes: 0 additions & 7 deletions spec/controllers/idv/doc_auth_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,6 @@
mock_next_step(:back_image)
allow_any_instance_of(Flow::BaseFlow).to \
receive(:flow_session).and_return(pii_from_doc: {})
result = {
success: true,
errors: {},
step: 'ssn',
step_count: 1,
pii_like_keypaths: [[:errors, :ssn], [:error_details, :ssn]],
}

put :update, params: { step: 'ssn', doc_auth: { step: 'ssn', ssn: '666-66-6666' } }
put :update, params: { step: 'ssn', doc_auth: { step: 'ssn', ssn: '111-11-1111' } }
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/idv_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
end

context 'no SP context' do
let(:user) { user = build(:user, password: ControllerHelper::VALID_PASSWORD) }
let(:user) { build(:user, password: ControllerHelper::VALID_PASSWORD) }

before do
stub_sign_in(user)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
it 'redirects to the two_factor_options page if user is IAL2' do
profile = create(:profile, :active, :verified, pii: { ssn: '1234' })
user = profile.user
raw_key = PersonalKeyGenerator.new(user).create
PersonalKeyGenerator.new(user).create
stub_sign_in_before_2fa(user)
get :show

Expand Down Expand Up @@ -86,7 +86,6 @@
profile = create(:profile, :active, :verified, pii: { ssn: '1234' })
user = profile.user
raw_key = PersonalKeyGenerator.new(user).create
old_key = user.reload.encrypted_recovery_code_digest
Comment thread
aduth marked this conversation as resolved.
stub_sign_in_before_2fa(user)
post :create, params: { personal_key_form: { personal_key: raw_key } }

Expand Down
2 changes: 1 addition & 1 deletion spec/features/idv/doc_auth/send_link_step_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@

it 'throttles sending the link' do
allow_any_instance_of(ApplicationController).to receive(:analytics).and_return(fake_analytics)
user = sign_in_and_2fa_user
sign_in_and_2fa_user
complete_doc_auth_steps_before_send_link_step
timeout = distance_of_time_in_words(Throttle.attempt_window_in_minutes(:idv_send_link).minutes)
freeze_time do
Expand Down
2 changes: 0 additions & 2 deletions spec/features/idv/steps/confirmation_step_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

context 'personal key information and actions' do
before do
personal_key = 'a1b2c3d4e5f6g7h8'

@user = sign_in_and_2fa_user

visit idv_path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
end

scenario 'resets password, not allowed to use personal key as 2fa', email: true do
personal_key = personal_key_from_pii(user, pii)
_personal_key = personal_key_from_pii(user, pii)
Comment thread
aduth marked this conversation as resolved.

trigger_reset_password_and_click_email_link(user.email)
reset_password_and_sign_back_in(user, new_password)
Expand Down
4 changes: 2 additions & 2 deletions spec/forms/new_phone_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
it 'is invalid' do
phone = PhoneFormatter.format('+1 (954) 525-1262', country_code: 'US')
params[:phone] = phone
phone_configuration = create(:phone_configuration, user: user, phone: phone)
create(:phone_configuration, user: user, phone: phone)

result = subject.submit(params)

Expand All @@ -167,7 +167,7 @@
raw_phone = '+1 954 5251262'
phone = PhoneFormatter.format(raw_phone, country_code: 'US')
params[:phone] = phone
phone_configuration = create(:phone_configuration, user: user, phone: raw_phone)
create(:phone_configuration, user: user, phone: raw_phone)

result = subject.submit(params)

Expand Down
1 change: 0 additions & 1 deletion spec/forms/otp_verification_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@

invalid_codes.each do |code|
form = OtpVerificationForm.new(user, code)
result = instance_double(FormResponse)
allow(user).to receive(:authenticate_direct_otp).with(code).and_return(true)

result = FormResponse.new(
Expand Down
4 changes: 2 additions & 2 deletions spec/forms/register_user_email_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
end

it 'creates throttle events after reaching throttle limit' do
existing_user = create(:user, :signed_up, email: 'taken@example.com')
create(:user, :signed_up, email: 'taken@example.com')

(IdentityConfig.store.reg_confirmed_email_max_attempts + 1).times do
subject.submit(email: 'TAKEN@example.com', terms_accepted: '1')
Expand Down Expand Up @@ -72,7 +72,7 @@
end

it 'creates throttle events after reaching throttle limit' do
user = create(:user, email: 'test@example.com', confirmed_at: nil, uuid: '123')
create(:user, email: 'test@example.com', confirmed_at: nil, uuid: '123')
(IdentityConfig.store.reg_unconfirmed_email_max_attempts + 1).times do
subject.submit(email: 'test@example.com', terms_accepted: '1')
end
Expand Down
4 changes: 2 additions & 2 deletions spec/forms/verify_password_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
password = 'cab123DZN456'
user = create(:user, password: password)
pii = { ssn: '111111111' }
profile = create(:profile, user: user, deactivation_reason: :password_reset, pii: pii)
create(:profile, user: user, deactivation_reason: :password_reset, pii: pii)

form = VerifyPasswordForm.new(
user: user, password: password,
Expand All @@ -25,7 +25,7 @@
password = 'cab123DZN456'
user = create(:user, password: password)
pii = { ssn: '111111111' }
profile = create(:profile, user: user, deactivation_reason: :password_reset, pii: pii)
create(:profile, user: user, deactivation_reason: :password_reset, pii: pii)

form = VerifyPasswordForm.new(
user: user, password: "#{password}a",
Expand Down
2 changes: 1 addition & 1 deletion spec/jobs/remove_old_throttles_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
subject(:perform) { job.perform(now, limit: limit, total_limit: total_limit) }

it 'deletes throttles that are older than WINDOW' do
old_throttle = create(:throttle, target: SecureRandom.hex, updated_at: now - 45.days)
_old_throttle = create(:throttle, target: SecureRandom.hex, updated_at: now - 45.days)
new_throttle = create(:throttle, target: SecureRandom.hex, updated_at: now)

perform
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@
iaa_end_date: iaa2_range.end.to_s,
},
]

expect(results).to match_array(rows)
Comment thread
aduth marked this conversation as resolved.
end
end

Expand Down
4 changes: 2 additions & 2 deletions spec/lib/telephony/otp_sender_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@

describe '#authentication_message' do
let(:sender) do
sender = Telephony::OtpSender.new(
Telephony::OtpSender.new(
to: '+18888675309',
otp: 'ABC123',
channel: 'sms',
Expand Down Expand Up @@ -306,7 +306,7 @@

describe '#confirmation_message' do
let(:sender) do
sender = Telephony::OtpSender.new(
Telephony::OtpSender.new(
to: '+18888675309',
otp: 'ABC123',
channel: 'sms',
Expand Down
1 change: 0 additions & 1 deletion spec/lib/telephony/pinpoint/aws_credential_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
end

it 'returns nil if STS raises a Seahorse::Client::NetworkingError' do
expected_credential = instance_double(Aws::AssumeRoleCredentials)
expect(Aws::STS::Client).to receive(:new).and_raise(
Seahorse::Client::NetworkingError.new(Net::ReadTimeout.new),
)
Expand Down
1 change: 0 additions & 1 deletion spec/mailers/user_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ def expect_email_body_to_have_help_and_contact_links
end

it 'renders the body' do
reset_text = t('user_mailer.account_reset_granted.cancel_link_text')
Comment thread
zachmargolis marked this conversation as resolved.
expect(mail.html_part.body).to have_content(
strip_tags(
t('user_mailer.account_reset_request.intro_html', app_name: APP_NAME),
Expand Down
2 changes: 1 addition & 1 deletion spec/models/phone_number_opt_out_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'rails_helper'

RSpec.describe PhoneNumberOptOut do
let(:phone) { phone = Faker::PhoneNumber.cell_phone }
let(:phone) { Faker::PhoneNumber.cell_phone }

describe '.create_or_find_by_phone' do
it 'creates a record for the phone' do
Expand Down
1 change: 0 additions & 1 deletion spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ class Analytics

config.before(:each) do
DocAuth::Mock::DocAuthMockClient.reset!
original_queue_adapter = ActiveJob::Base.queue_adapter
Comment thread
aduth marked this conversation as resolved.
descendants = ActiveJob::Base.descendants + [ActiveJob::Base]

ActiveJob::Base.queue_adapter = :inline
Expand Down
1 change: 0 additions & 1 deletion spec/services/analytics_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
end

it 'tracks the user passed in to the track_event method' do
current_user = build_stubbed(:user, uuid: '123')
tracked_user = build_stubbed(:user, uuid: '456')

analytics_hash = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
end

it 'calls analytics if missing from no document capture session' do
response = subject.call
subject.call

expect(analytics).to have_logged_event('Proofing Document Result Missing', {})
expect(analytics).to have_logged_event(
Expand All @@ -65,7 +65,7 @@

expect(subject).to receive(:verify_document_capture_session).
and_return(verify_document_capture_session).at_least(:once)
response = subject.call
subject.call

expect(analytics).to have_logged_event('Proofing Document Result Missing', {})
expect(analytics).to have_logged_event(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@

it 'returns false if the code does not match' do
bad_code = '1' * (TwoFactorAuthenticatable::DIRECT_OTP_LENGTH - 1)
expect(subject.matches_code?('11111')).to eq(false)
expect(subject.matches_code?(bad_code)).to eq(false)
end

it 'uses a secure comparison' do
Expand Down
2 changes: 1 addition & 1 deletion spec/services/proofing/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def hello(applicant, results)

it 'does not affect the other proofer' do
# This is an explicit check for class-level side effects
impl2 = Class.new(Proofing::Base) do
_impl2 = Class.new(Proofing::Base) do
required_attributes :foobarbaz
end
expect(subject.exception?).to eq(false)
Expand Down
2 changes: 1 addition & 1 deletion spec/support/deprecated_classes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def self.deprecated_classes
def modified_tag_option(key, value, *rest)
original_result = original_tag_option(key, value, *rest)
return original_result unless key.to_s == 'class'
attribute, classes = original_result.split('=')
_attribute, classes = original_result.split('=')
classes = classes.tr('"', '').split(/ +/)
regex = self.class.deprecated_classes.find { |r| classes.any? { |c| r =~ c } }
raise "CSS class '#{value}' matched regex for deprecated classes #{regex}" if regex
Expand Down
4 changes: 2 additions & 2 deletions spec/support/features/document_capture_step_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def simulate_image_upload_api_submission
connection = Faraday.new(url: document_capture_endpoint_host) do |conn|
conn.request(:multipart)
end
response = connection.post document_capture_endpoint_path, image_upload_api_payload
connection.post document_capture_endpoint_path, image_upload_api_payload
page.execute_script('document.querySelector(".js-document-capture-form").submit();')
end

Expand All @@ -59,7 +59,7 @@ def document_capture_session_uuid
end

def document_capture_endpoint_uri
URI.parse(endpoint = document_capture_form['data-endpoint'])
URI.parse(document_capture_form['data-endpoint'])
end

def document_capture_endpoint_host
Expand Down
1 change: 0 additions & 1 deletion spec/support/shared_examples/sign_in.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
shared_examples 'signing in as IAL2 with personal key' do |sp|
it 'does not present personal key as an MFA option', :email do
user = create_ial2_account_go_back_to_sp_and_sign_out(sp)
pii = { ssn: '666-66-1234', dob: '1920-01-01', first_name: 'alice' }

Capybara.reset_sessions!

Expand Down