Skip to content

Commit 237974d

Browse files
committed
rubocop-rails to standard-rails
reverts previous rubocop-rails fixes before 'new' fixes
1 parent cf99d64 commit 237974d

File tree

56 files changed

+100
-221
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+100
-221
lines changed

.rubocop.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
require:
22
- rubocop-capybara
33
- rubocop-factory_bot
4-
- rubocop-rails
54
- rubocop-rspec
65
- rubocop-rspec_rails
76

.standard.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
extend_config:
22
- .rubocop.yml
33

4+
plugins:
5+
- standard-rails
6+
47
ignore:
58
- 'storage/**/*'
69
- 'db/migrate/2020*.rb'

.standard_todo.yml

Lines changed: 17 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -2,148 +2,106 @@
22
# Remove from this list as you refactor files.
33
---
44
ignore:
5-
- app/callbacks/case_contact_metadata_callback.rb:
6-
- Rails/SkipsModelValidations
7-
- app/components/modal/body_component.rb:
8-
- Rails/OutputSafety
95
- app/controllers/all_casa_admins/sessions_controller.rb:
106
- Rails/LexicallyScopedActionFilter
117
- app/controllers/api/v1/base_controller.rb:
128
- Rails/LexicallyScopedActionFilter
139
- app/controllers/casa_cases_controller.rb:
1410
- Rails/TimeZone
15-
- Rails/DynamicFindBy
16-
- app/controllers/case_assignments_controller.rb:
17-
- Rails/SkipsModelValidations
1811
- app/controllers/case_contacts_controller.rb:
1912
- Rails/LexicallyScopedActionFilter
2013
- app/controllers/checklist_items_controller.rb:
21-
- Rails/SkipsModelValidations
2214
- Rails/TimeZone
2315
- app/controllers/court_dates_controller.rb:
2416
- Rails/TimeZone
2517
- app/controllers/placements_controller.rb:
2618
- Rails/LexicallyScopedActionFilter
2719
- app/controllers/reimbursements_controller.rb:
2820
- Rails/TimeZone
29-
- Rails/SkipsModelValidations
3021
- app/controllers/users/sessions_controller.rb:
3122
- Rails/LexicallyScopedActionFilter
23+
- app/datatables/volunteer_datatable.rb:
24+
- Rails/CompactBlank
3225
- app/decorators/casa_case_decorator.rb:
3326
- Rails/Date
3427
- app/decorators/case_assignment_decorator.rb:
3528
- Rails/Date
36-
- app/helpers/all_casa_admins/casa_orgs_helper.rb:
37-
- Rails/HelperInstanceVariable
3829
- app/helpers/banner_helper.rb:
39-
- Rails/HelperInstanceVariable
4030
- Rails/TimeZone
41-
- app/helpers/contact_types_helper.rb:
42-
- Rails/HelperInstanceVariable
4331
- app/helpers/phone_number_helper.rb:
4432
- Rails/Blank
45-
- app/helpers/sidebar_helper.rb:
46-
- Rails/OutputSafety
47-
- app/helpers/ui_helper.rb:
48-
- Rails/HelperInstanceVariable
49-
- Rails/OutputSafety
5033
- app/mailers/fund_request_mailer.rb:
5134
- Rails/Date
5235
- app/mailers/learning_hours_mailer.rb:
5336
- Rails/Date
5437
- app/mailers/supervisor_mailer.rb:
5538
- Rails/Date
5639
- app/models/casa_case.rb:
57-
- Rails/HasManyOrHasOneDependent
58-
- Rails/InverseOf
40+
- Rails/IgnoredColumnsAssignment
5941
- Rails/Date
42+
- Rails/PluckInWhere
6043
- app/models/casa_case_contact_type.rb:
6144
- Rails/UniqueValidationWithoutIndex
6245
- app/models/casa_case_emancipation_category.rb:
6346
- Rails/UniqueValidationWithoutIndex
6447
- app/models/casa_org.rb:
6548
- Rails/UniqueValidationWithoutIndex
66-
- Rails/HasManyOrHasOneDependent
6749
- app/models/case_assignment.rb:
6850
- Rails/UniqueValidationWithoutIndex
51+
- Rails/RedundantPresenceValidationOnBelongsTo
6952
- app/models/case_contact.rb:
70-
- Rails/HasManyOrHasOneDependent
71-
- Rails/InverseOf
7253
- Rails/FindEach
7354
- app/models/case_contact_contact_type.rb:
7455
- Rails/UniqueValidationWithoutIndex
7556
- app/models/case_group.rb:
7657
- Rails/UniqueValidationWithoutIndex
7758
- app/models/concerns/CasaCase/validations.rb:
7859
- Rails/TimeZone
79-
- app/models/contact_topic.rb:
80-
- Rails/HasManyOrHasOneDependent
8160
- app/models/contact_type.rb:
82-
- Rails/HasManyOrHasOneDependent
8361
- Rails/UniqueValidationWithoutIndex
8462
- app/models/contact_type_group.rb:
85-
- Rails/HasManyOrHasOneDependent
8663
- Rails/UniqueValidationWithoutIndex
87-
- app/models/court_date.rb:
88-
- Rails/HasManyOrHasOneDependent
89-
- app/models/emancipation_category.rb:
90-
- Rails/HasManyOrHasOneDependent
9164
- app/models/hearing_type.rb:
92-
- Rails/HasManyOrHasOneDependent
9365
- Rails/UniqueValidationWithoutIndex
9466
- app/models/judge.rb:
9567
- Rails/UniqueValidationWithoutIndex
9668
- app/models/language.rb:
97-
- Rails/HasManyOrHasOneDependent
9869
- Rails/UniqueValidationWithoutIndex
9970
- app/models/learning_hour.rb:
10071
- Rails/Date
10172
- app/models/learning_hour_topic.rb:
10273
- Rails/UniqueValidationWithoutIndex
10374
- app/models/learning_hour_type.rb:
10475
- Rails/UniqueValidationWithoutIndex
105-
- app/models/sms_notification_event.rb:
106-
- Rails/HasManyOrHasOneDependent
107-
- app/models/supervisor.rb:
108-
- Rails/HasManyOrHasOneDependent
109-
- Rails/InverseOf
110-
- Rails/SkipsModelValidations
76+
- app/models/mileage_rate.rb:
77+
- Rails/IgnoredColumnsAssignment
11178
- app/models/supervisor_volunteer.rb:
11279
- Rails/UniqueValidationWithoutIndex
11380
- app/models/user.rb:
114-
- Rails/InverseOf
115-
- Rails/HasManyOrHasOneDependent
11681
- Rails/Date
11782
- app/models/volunteer.rb:
118-
- Rails/SkipsModelValidations
119-
- app/services/backfill_followupable_service.rb:
120-
- Rails/SkipsModelValidations
83+
- Rails/WhereEquals
84+
- app/services/casa_case_change_service.rb:
85+
- Rails/Pluck
12186
- app/services/fdf_inputs_service.rb:
12287
- Rails/Blank
88+
- Rails/RootPathnameMethods
12389
- app/validators/user_validator.rb:
12490
- Rails/Blank
12591
- config/application.rb:
12692
- Style/RedundantInterpolation
127-
- db/migrate/20240415160842_add_followupable_to_followups.rb:
128-
- Rails/BulkChangeTable
12993
- db/seeds/db_populator.rb:
13094
- Rails/TimeZone
13195
- Rails/FindEach
13296
- Rails/Date
133-
- Rails/SkipsModelValidations
134-
- db/seeds/emancipation_options_prune.rb:
135-
- Rails/SkipsModelValidations
13697
- lib/mailers/debug_preview_mailer.rb:
13798
- Rails/ApplicationMailer
13899
- lib/mailers/previews/devise_mailer_preview.rb:
139-
- Rails/SkipsModelValidations
140100
- Rails/Date
141101
- lib/mailers/previews/fund_request_mailer_preview.rb:
142102
- Rails/Date
143103
- lib/mailers/previews/volunteer_mailer_preview.rb:
144104
- Rails/Date
145-
- lib/tasks/auto_annotate_models.rake:
146-
- Rails/RakeEnvironment
147105
- lib/tasks/case_contact_types_reminder.rb:
148106
- Rails/ActiveRecordAliases
149107
- lib/tasks/data_post_processors/contact_topic_populator.rb:
@@ -153,7 +111,6 @@ ignore:
153111
- lib/tasks/deployment/20240604121427_migrate_notifications.rake:
154112
- Rails/ApplicationRecord
155113
- lib/tasks/deployment/99991023145114_store_deploy_time.rake:
156-
- Rails/SkipsModelValidations
157114
- Rails/TimeZone
158115
- lib/tasks/no_contact_made_reminder.rb:
159116
- Rails/ActiveRecordAliases
@@ -255,6 +212,7 @@ ignore:
255212
- RSpec/MultipleMemoizedHelpers
256213
- RSpec/NestedGroups
257214
- RSpec/NamedSubject
215+
- Rails/Pluck
258216
- spec/datatables/volunteer_datatable_spec.rb:
259217
- RSpec/MultipleMemoizedHelpers
260218
- RSpec/SubjectDeclaration
@@ -264,9 +222,9 @@ ignore:
264222
- RSpec/ExpectInLet
265223
- RSpec/NoExpectationExample
266224
- RSpec/IndexedLet
225+
- Rails/Pluck
267226
- RSpec/NamedSubject
268227
- RSpec/MultipleExpectations
269-
- Rails/SkipsModelValidations
270228
- spec/decorators/android_app_association_decorator_spec.rb:
271229
- RSpec/EmptyExampleGroup
272230
- spec/decorators/casa_case_decorator_spec.rb:
@@ -278,7 +236,6 @@ ignore:
278236
- RSpec/MessageSpies
279237
- RSpec/VerifiedDoubles
280238
- spec/decorators/case_contact_decorator_spec.rb:
281-
- Rails/SkipsModelValidations
282239
- RSpec/NestedGroups
283240
- spec/decorators/case_contacts/form_decorator_spec.rb:
284241
- RSpec/EmptyExampleGroup
@@ -288,20 +245,15 @@ ignore:
288245
- RSpec/MultipleMemoizedHelpers
289246
- RSpec/IndexedLet
290247
- RSpec/NamedSubject
291-
- spec/decorators/other_duty_decorator_spec.rb:
292-
- Rails/SkipsModelValidations
293248
- spec/decorators/patch_note_decorator_spec.rb:
294249
- RSpec/EmptyExampleGroup
295250
- spec/decorators/placement_decorator_spec.rb:
296251
- RSpec/SpecFilePathFormat
297-
- Rails/SkipsModelValidations
298252
- spec/decorators/user_decorator_spec.rb:
299253
- RSpec/RepeatedDescription
300254
- Rails/TimeZone
301255
- spec/decorators/volunteer_decorator_spec.rb:
302256
- RSpec/MultipleExpectations
303-
- spec/factories/case_contacts.rb:
304-
- Rails/SkipsModelValidations
305257
- spec/factories/healths.rb:
306258
- Rails/TimeZone
307259
- spec/factories/login_activities.rb:
@@ -316,7 +268,6 @@ ignore:
316268
- RSpec/ExampleLength
317269
- RSpec/VerifiedDoubles
318270
- RSpec/BeEq
319-
- Rails/SkipsModelValidations
320271
- spec/helpers/case_contacts_helper_spec.rb:
321272
- RSpec/InstanceVariable
322273
- RSpec/BeEq
@@ -335,7 +286,6 @@ ignore:
335286
- spec/helpers/notifications_helper_spec.rb:
336287
- RSpec/ContextWording
337288
- Rails/TimeZone
338-
- Rails/SkipsModelValidations
339289
- RSpec/MultipleMemoizedHelpers
340290
- RSpec/MultipleExpectations
341291
- RSpec/ExampleLength
@@ -377,7 +327,6 @@ ignore:
377327
- RSpec/ContextWording
378328
- RSpec/MultipleExpectations
379329
- RSpec/DescribedClass
380-
- Rails/SkipsModelValidations
381330
- RSpec/ExampleLength
382331
- spec/lib/tasks/data_post_processors/case_contact_populator_spec.rb:
383332
- RSpec/MultipleExpectations
@@ -440,7 +389,6 @@ ignore:
440389
- RSpec/ExampleLength
441390
- RSpec/NamedSubject
442391
- spec/models/banner_spec.rb:
443-
- Rails/SkipsModelValidations
444392
- RSpec/MultipleExpectations
445393
- RSpec/ExampleLength
446394
- spec/models/casa_admin_spec.rb:
@@ -472,6 +420,7 @@ ignore:
472420
- RSpec/MessageChain
473421
- RSpec/ContextWording
474422
- Style/RedundantInterpolation
423+
- Rails/Pluck
475424
- Rails/Date
476425
- RSpec/LetSetup
477426
- RSpec/MultipleExpectations
@@ -520,7 +469,6 @@ ignore:
520469
- RSpec/MultipleMemoizedHelpers
521470
- RSpec/DescribedClass
522471
- RSpec/NamedSubject
523-
- Rails/SkipsModelValidations
524472
- RSpec/RepeatedDescription
525473
- spec/models/case_group_spec.rb:
526474
- RSpec/ExampleLength
@@ -531,6 +479,7 @@ ignore:
531479
- RSpec/DescribedClass
532480
- RSpec/NestedGroups
533481
- RSpec/ContextWording
482+
- Rails/Pluck
534483
- spec/models/contact_type_group_spec.rb:
535484
- RSpec/IndexedLet
536485
- RSpec/MultipleExpectations
@@ -642,7 +591,6 @@ ignore:
642591
- RSpec/MessageSpies
643592
- RSpec/BeEq
644593
- RSpec/ExampleLength
645-
- Rails/SkipsModelValidations
646594
- RSpec/NestedGroups
647595
- RSpec/DescribedClass
648596
- RSpec/ContextWording
@@ -717,7 +665,6 @@ ignore:
717665
- spec/policies/hearing_type_policy_spec.rb:
718666
- RSpec/NamedSubject
719667
- RSpec/ExampleLength
720-
- Rails/SkipsModelValidations
721668
- spec/policies/import_policy_spec.rb:
722669
- RSpec/NamedSubject
723670
- spec/policies/judge_policy_spec.rb:
@@ -771,6 +718,7 @@ ignore:
771718
- spec/requests/all_casa_admins/casa_orgs_spec.rb:
772719
- RSpec/MessageSpies
773720
- RSpec/MultipleExpectations
721+
- Rails/Pluck
774722
- spec/requests/all_casa_admins/patch_notes_spec.rb:
775723
- RSpec/MultipleExpectations
776724
- RSpec/MultipleMemoizedHelpers
@@ -793,7 +741,6 @@ ignore:
793741
- RSpec/ExampleLength
794742
- RSpec/MultipleExpectations
795743
- RSpec/LetSetup
796-
- Rails/SkipsModelValidations
797744
- RSpec/MultipleMemoizedHelpers
798745
- RSpec/NestedGroups
799746
- spec/requests/bulk_court_dates_spec.rb:
@@ -958,7 +905,6 @@ ignore:
958905
- RSpec/NestedGroups
959906
- spec/requests/notifications_spec.rb:
960907
- RSpec/NestedGroups
961-
- Rails/SkipsModelValidations
962908
- Rails/Date
963909
- RSpec/MultipleMemoizedHelpers
964910
- RSpec/IndexedLet
@@ -1369,7 +1315,6 @@ ignore:
13691315
- RSpec/NestedGroups
13701316
- RSpec/ExampleLength
13711317
- RSpec/IndexedLet
1372-
- Rails/OutputSafety
13731318
- RSpec/VoidExpect
13741319
- spec/system/supervisors/new_spec.rb:
13751320
- RSpec/ExampleLength
@@ -1495,7 +1440,6 @@ ignore:
14951440
- spec/views/notifications/index.html.erb_spec.rb:
14961441
- RSpec/MultipleMemoizedHelpers
14971442
- RSpec/IndexedLet
1498-
- Rails/SkipsModelValidations
14991443
- RSpec/ExampleLength
15001444
- RSpec/MultipleExpectations
15011445
- RSpec/BeEql
@@ -1526,6 +1470,7 @@ ignore:
15261470
- RSpec/EmptyExampleGroup
15271471
- RSpec/ContextWording
15281472
- spec/views/templates/email_templates_spec.rb:
1473+
- Rails/RootPathnameMethods
15291474
- RSpec/MultipleDescribes
15301475
- spec/views/volunteers/edit.html.erb_spec.rb:
15311476
- RSpec/ExampleLength

app/controllers/api/v1/base_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def authenticate_user!
88
if user && token && ActiveSupport::SecurityUtils.secure_compare(user.token, token)
99
@current_user = user
1010
else
11-
render json: {message: "Wrong password or email"}, status: :unauthorized
11+
render json: {message: "Wrong password or email"}, status: 401
1212
end
1313
end
1414

app/controllers/api/v1/users/sessions_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ class Api::V1::Users::SessionsController < Api::V1::BaseController
22
def create
33
load_resource
44
if @user
5-
render json: Api::V1::SessionBlueprint.render(@user), status: :created
5+
render json: Api::V1::SessionBlueprint.render(@user), status: 201
66
else
7-
render json: {message: "Wrong password or email"}, status: :unauthorized
7+
render json: {message: "Wrong password or email"}, status: 401
88
end
99
end
1010

app/controllers/casa_admins_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def create
4545

4646
begin
4747
casa_admin = service.create!
48-
if casa_admin.phone_number.present?
48+
if !casa_admin.phone_number.blank?
4949
raw_token = casa_admin.raw_invitation_token
5050
base_domain = request.base_url + "/users/edit"
5151
invitation_url = Rails.application.routes.url_helpers.accept_user_invitation_url(invitation_token: raw_token, host: request.base_url)

app/controllers/users/passwords_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ def valid_params?(email, phone_number)
6161
end
6262

6363
def email?
64-
@email.present?
64+
!@email.blank?
6565
end
6666

6767
def phone_number?
68-
@phone_number.present?
68+
!@phone_number.blank?
6969
end
7070

7171
def empty_fields_error

0 commit comments

Comments
 (0)