diff --git a/.standard_todo.yml b/.standard_todo.yml deleted file mode 100644 index 45a0558bc6..0000000000 --- a/.standard_todo.yml +++ /dev/null @@ -1,242 +0,0 @@ -# Auto generated files with errors to ignore. -# Remove from this list as you refactor files. ---- -ignore: -- app/controllers/all_casa_admins/sessions_controller.rb: - - Layout/EmptyLinesAfterModuleInclusion - - Rails/LexicallyScopedActionFilter -- app/controllers/api/v1/base_controller.rb: - - Rails/LexicallyScopedActionFilter -- app/controllers/casa_cases_controller.rb: - - Rails/TimeZone - - Style/EmptyStringInsideInterpolation -- app/controllers/case_contacts/followups_controller.rb: - - Layout/EmptyLineAfterGuardClause -- app/controllers/case_contacts_controller.rb: - - Rails/LexicallyScopedActionFilter - - Style/HashSlice -- app/controllers/checklist_items_controller.rb: - - Rails/TimeZone -- app/controllers/court_dates_controller.rb: - - Rails/TimeZone -- app/controllers/emancipation_checklists_controller.rb: - - Layout/EmptyLinesAfterModuleInclusion -- app/controllers/imports_controller.rb: - - Layout/EmptyLinesAfterModuleInclusion -- app/controllers/other_duties_controller.rb: - - Layout/EmptyLineAfterGuardClause -- app/controllers/placements_controller.rb: - - Rails/LexicallyScopedActionFilter -- app/controllers/reimbursements_controller.rb: - - Rails/TimeZone -- app/controllers/users/sessions_controller.rb: - - Layout/EmptyLinesAfterModuleInclusion - - Rails/LexicallyScopedActionFilter -- app/datatables/volunteer_datatable.rb: - - Rails/CompactBlank - - Style/EmptyStringInsideInterpolation -- app/decorators/casa_case_decorator.rb: - - Layout/EmptyLineAfterGuardClause - - Rails/Date -- app/decorators/case_assignment_decorator.rb: - - Rails/Date -- app/decorators/contact_type_decorator.rb: - - Layout/EmptyLinesAfterModuleInclusion -- app/helpers/banner_helper.rb: - - Rails/TimeZone -- app/helpers/followup_helper.rb: - - Layout/EmptyLineAfterGuardClause -- app/helpers/phone_number_helper.rb: - - Rails/Blank - - Style/RedundantRegexpEscape -- app/helpers/sidebar_helper.rb: - - Layout/EmptyLineAfterGuardClause -- app/mailers/fund_request_mailer.rb: - - Rails/Date -- app/mailers/learning_hours_mailer.rb: - - Rails/Date -- app/mailers/supervisor_mailer.rb: - - Rails/Date -- app/models/casa_case.rb: - - Rails/IgnoredColumnsAssignment - - Rails/Date - - Rails/PluckInWhere -- app/models/casa_case_contact_type.rb: - - Rails/UniqueValidationWithoutIndex -- app/models/casa_case_emancipation_category.rb: - - Rails/UniqueValidationWithoutIndex -- app/models/casa_org.rb: - - Layout/EmptyLinesAfterModuleInclusion - - Rails/UniqueValidationWithoutIndex -- app/models/case_assignment.rb: - - Rails/UniqueValidationWithoutIndex - - Rails/RedundantPresenceValidationOnBelongsTo -- app/models/case_contact.rb: - - Layout/EmptyLinesAfterModuleInclusion - - Rails/FindEach -- app/models/case_contact_contact_type.rb: - - Rails/UniqueValidationWithoutIndex -- app/models/case_group.rb: - - Rails/UniqueValidationWithoutIndex -- app/models/concerns/CasaCase/validations.rb: - - Rails/TimeZone -- app/models/concerns/api.rb: - - Layout/EmptyLinesAfterModuleInclusion -- app/models/contact_type.rb: - - Rails/UniqueValidationWithoutIndex -- app/models/contact_type_group.rb: - - Rails/UniqueValidationWithoutIndex -- app/models/hearing_type.rb: - - Rails/UniqueValidationWithoutIndex -- app/models/judge.rb: - - Rails/UniqueValidationWithoutIndex -- app/models/language.rb: - - Rails/UniqueValidationWithoutIndex -- app/models/learning_hour.rb: - - Rails/Date -- app/models/learning_hour_topic.rb: - - Rails/UniqueValidationWithoutIndex -- app/models/learning_hour_type.rb: - - Rails/UniqueValidationWithoutIndex -- app/models/mileage_rate.rb: - - Rails/IgnoredColumnsAssignment -- app/models/supervisor_volunteer.rb: - - Rails/UniqueValidationWithoutIndex -- app/models/user.rb: - - Rails/Date -- app/models/volunteer.rb: - - Rails/WhereEquals - - Layout/EmptyLineAfterGuardClause -- app/notifications/delivery_methods/sms.rb: - - Layout/EmptyLinesAfterModuleInclusion -- app/policies/user_policy.rb: - - Layout/EmptyLineAfterGuardClause -- app/services/casa_case_change_service.rb: - - Rails/Pluck - - Layout/EmptyLineAfterGuardClause -- app/services/case_contacts_export_csv_service.rb: - - Layout/EmptyLineAfterGuardClause -- app/services/fdf_inputs_service.rb: - - Layout/EmptyLineAfterGuardClause - - Rails/Blank - - Rails/RootPathnameMethods -- app/services/learning_hours_export_csv_service.rb: - - Layout/EmptyLineAfterGuardClause -- app/services/short_url_service.rb: - - Layout/EmptyLinesAfterModuleInclusion -- app/validators/user_validator.rb: - - Rails/Blank -- config/application.rb: - - Style/RedundantInterpolation -- config/initializers/bugsnag.rb: - - Style/FileNull -- db/migrate/20250507011754_remove_unused_indexes.rb: - - Rails/ReversibleMigration -- db/seeds/db_populator.rb: - - Layout/EmptyLineAfterGuardClause - - Rails/TimeZone - - Rails/FindEach - - Rails/Date -- lib/mailers/debug_preview_mailer.rb: - - Rails/ApplicationMailer -- lib/mailers/previews/devise_mailer_preview.rb: - - Rails/Date -- lib/mailers/previews/fund_request_mailer_preview.rb: - - Rails/Date -- lib/mailers/previews/volunteer_mailer_preview.rb: - - Rails/Date -- lib/tasks/case_contact_types_reminder.rb: - - Layout/EmptyLineAfterGuardClause - - Rails/ActiveRecordAliases -- lib/tasks/data_post_processors/contact_topic_populator.rb: - - Rails/FindEach -- lib/tasks/data_post_processors/contact_type_populator.rb: - - Rails/FindEach -- lib/tasks/deployment/20240604121427_migrate_notifications.rake: - - Rails/ApplicationRecord -- lib/tasks/deployment/99991023145114_store_deploy_time.rake: - - Rails/TimeZone -- lib/tasks/example_recurring_task.rb: - - Layout/EmptyLinesAfterModuleInclusion -- lib/tasks/lint_factory_bot.rake: - - Layout/EmptyLineAfterGuardClause -- lib/tasks/no_contact_made_reminder.rb: - - Rails/ActiveRecordAliases -- lib/tasks/supervisor_weekly_digest.rb: - - Rails/TimeZone -- lib/tasks/test_checker.rake: - - Layout/EmptyLineAfterGuardClause -- scripts/import_casa_case_date_of_birth.rb: - - Layout/EmptyLineAfterGuardClause -- spec/controllers/concerns/accessible_spec.rb: - - Layout/EmptyLinesAfterModuleInclusion -- spec/datatables/reimbursement_datatable_spec.rb: - - Rails/TimeZone -- spec/decorators/casa_case_decorator_spec.rb: - - Rails/TimeZone -- spec/decorators/user_decorator_spec.rb: - - Rails/TimeZone -- spec/factories/healths.rb: - - Rails/TimeZone -- spec/factories/users.rb: - - Rails/TimeZone -- spec/helpers/notifications_helper_spec.rb: - - Rails/TimeZone -- spec/lib/tasks/data_post_processors/contact_topic_populator_spec.rb: - - Rails/FindEach -- spec/lib/tasks/data_post_processors/contact_type_populator_spec.rb: - - Rails/FindEach -- spec/mailers/learning_hours_mailer_spec.rb: - - Rails/Date -- spec/mailers/supervisor_mailer_spec.rb: - - Rails/Date -- spec/models/casa_case_spec.rb: - - Rails/TimeZone -- spec/models/casa_org_spec.rb: - - Style/RedundantInterpolation - - Rails/Date -- spec/models/case_contact_report_spec.rb: - - Performance/Count -- spec/models/case_contact_spec.rb: - - Rails/TimeZone -- spec/models/case_court_report_spec.rb: - - Layout/EmptyLinesAfterModuleInclusion -- spec/models/learning_hours_report_spec.rb: - - Layout/EmptyLineAfterGuardClause -- spec/requests/bulk_court_dates_spec.rb: - - Rails/Date -- spec/requests/casa_cases_spec.rb: - - Rails/Date - - Rails/TimeZone -- spec/requests/case_contact_reports_spec.rb: - - Rails/Date -- spec/requests/case_court_reports_spec.rb: - - Layout/EmptyLinesAfterModuleInclusion -- spec/requests/court_dates_spec.rb: - - Layout/EmptyLinesAfterModuleInclusion -- spec/requests/notifications_spec.rb: - - Rails/Date -- spec/system/casa_cases/edit_spec.rb: - - Rails/Date -- spec/system/casa_cases/new_spec.rb: - - Rails/Date -- spec/system/case_contacts/new_spec.rb: - - Rails/Date -- spec/system/checklist_items/destroy_spec.rb: - - Rails/TimeZone -- spec/system/checklist_items/edit_spec.rb: - - Rails/TimeZone -- spec/system/checklist_items/new_spec.rb: - - Rails/TimeZone -- spec/system/learning_hours/edit_spec.rb: - - Rails/Date -- spec/system/other_duties/new_spec.rb: - - Rails/Date -- spec/system/reports/index_spec.rb: - - Rails/Date -- spec/system/volunteers/edit_spec.rb: - - Rails/Date -- spec/views/casa_orgs/edit.html.erb_spec.rb: - - Style/RedundantInterpolation -- spec/views/templates/email_templates_spec.rb: - - Rails/RootPathnameMethods diff --git a/app/controllers/all_casa_admins/sessions_controller.rb b/app/controllers/all_casa_admins/sessions_controller.rb index 1c41a5ec44..bd799d9cc9 100644 --- a/app/controllers/all_casa_admins/sessions_controller.rb +++ b/app/controllers/all_casa_admins/sessions_controller.rb @@ -2,5 +2,6 @@ class AllCasaAdmins::SessionsController < Devise::SessionsController include Accessible + skip_before_action :check_user, only: :destroy end diff --git a/app/controllers/casa_cases_controller.rb b/app/controllers/casa_cases_controller.rb index 4f07a8099e..09c035a713 100644 --- a/app/controllers/casa_cases_controller.rb +++ b/app/controllers/casa_cases_controller.rb @@ -184,7 +184,7 @@ def case_contact_csv_name(case_contacts) casa_case_number = case_contacts&.first&.casa_case&.case_number current_date = Time.now.strftime("%Y-%m-%d") - "#{casa_case_number.nil? ? "" : casa_case_number + "-"}case-contacts-#{current_date}.csv" + "#{casa_case_number + "-" unless casa_case_number.nil?}case-contacts-#{current_date}.csv" end def court_date_unknown? diff --git a/app/controllers/emancipation_checklists_controller.rb b/app/controllers/emancipation_checklists_controller.rb index a004ff1435..e2ef1129ac 100644 --- a/app/controllers/emancipation_checklists_controller.rb +++ b/app/controllers/emancipation_checklists_controller.rb @@ -1,5 +1,6 @@ class EmancipationChecklistsController < ApplicationController include DateHelper + before_action :require_organization! after_action :verify_authorized diff --git a/app/controllers/imports_controller.rb b/app/controllers/imports_controller.rb index cc445ff249..8ee483bbd3 100644 --- a/app/controllers/imports_controller.rb +++ b/app/controllers/imports_controller.rb @@ -2,6 +2,7 @@ class ImportsController < ApplicationController require "csv" include ActionView::Helpers::UrlHelper + before_action :failed_csv_service, only: [:create, :download_failed] after_action :verify_authorized diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb index a1afeb575d..6366a2c746 100644 --- a/app/controllers/users/sessions_controller.rb +++ b/app/controllers/users/sessions_controller.rb @@ -2,5 +2,6 @@ class Users::SessionsController < Devise::SessionsController include Accessible + skip_before_action :check_user, only: :destroy end diff --git a/app/datatables/volunteer_datatable.rb b/app/datatables/volunteer_datatable.rb index ffb8c7de5e..35a0680d1a 100644 --- a/app/datatables/volunteer_datatable.rb +++ b/app/datatables/volunteer_datatable.rb @@ -166,7 +166,7 @@ def transition_aged_youth_filter filter = additional_filters[:transition_aged_youth] bool_filter filter do - "transition_aged_youth_cases.volunteer_id IS #{(filter[0] == "true") ? "NOT" : nil} NULL" + "transition_aged_youth_cases.volunteer_id IS #{"NOT" if filter[0] == "true"} NULL" end }.call end diff --git a/app/decorators/contact_type_decorator.rb b/app/decorators/contact_type_decorator.rb index 855baa57d3..1f6d7ece0d 100644 --- a/app/decorators/contact_type_decorator.rb +++ b/app/decorators/contact_type_decorator.rb @@ -1,5 +1,6 @@ class ContactTypeDecorator < Draper::Decorator include ActionView::Helpers::DateHelper + delegate_all def hash_for_multi_select_with_cases(casa_case_ids) diff --git a/app/helpers/phone_number_helper.rb b/app/helpers/phone_number_helper.rb index 15d61d3846..b997103f2f 100644 --- a/app/helpers/phone_number_helper.rb +++ b/app/helpers/phone_number_helper.rb @@ -34,6 +34,6 @@ def valid_phone_number(number) end def strip_unnecessary_characters(number) - number.gsub(/[()\+\s\-\.]/, "") + number.gsub(/[()+\s\-.]/, "") end end diff --git a/app/models/casa_org.rb b/app/models/casa_org.rb index e6a942f58b..f874d21c78 100644 --- a/app/models/casa_org.rb +++ b/app/models/casa_org.rb @@ -1,5 +1,6 @@ class CasaOrg < ApplicationRecord prepend ActiveSupport::ToJsonWithActiveSupportEncoder + # NOTE: location of the default report template CASA_DEFAULT_COURT_REPORT = File.new(Rails.root.join("app/documents/templates/default_report_template.docx"), "r") CASA_DEFAULT_LOGO = Rails.public_path.join("logo.jpeg") diff --git a/app/models/case_contact.rb b/app/models/case_contact.rb index 54933056b5..8e3fb8ae0a 100644 --- a/app/models/case_contact.rb +++ b/app/models/case_contact.rb @@ -1,5 +1,6 @@ class CaseContact < ApplicationRecord include ByOrganizationScope + acts_as_paranoid attr_accessor :duration_hours diff --git a/app/models/concerns/api.rb b/app/models/concerns/api.rb index b62f5e0170..78a8bcdfff 100644 --- a/app/models/concerns/api.rb +++ b/app/models/concerns/api.rb @@ -1,5 +1,6 @@ module Api extend ActiveSupport::Concern + included do has_one :api_credential, dependent: :destroy after_create :initialize_api_credentials diff --git a/app/notifications/delivery_methods/sms.rb b/app/notifications/delivery_methods/sms.rb index d1fefb7150..b79ee59726 100644 --- a/app/notifications/delivery_methods/sms.rb +++ b/app/notifications/delivery_methods/sms.rb @@ -1,5 +1,6 @@ class DeliveryMethods::Sms < Noticed::DeliveryMethod include SmsBodyHelper + def deliver if sender.casa_admin? || sender.supervisor? short_io_api = ShortUrlService.new diff --git a/app/services/short_url_service.rb b/app/services/short_url_service.rb index 759158a74b..c04874a878 100644 --- a/app/services/short_url_service.rb +++ b/app/services/short_url_service.rb @@ -6,6 +6,7 @@ class ShortUrlService include ApiBaseHelper include RequestHeaderHelper include HTTParty + base_uri SHORT_IO headers ACCEPT_JSON headers CONTENT_TYPE_JSON diff --git a/lib/tasks/example_recurring_task.rb b/lib/tasks/example_recurring_task.rb index c3bdefb481..c1687739a4 100644 --- a/lib/tasks/example_recurring_task.rb +++ b/lib/tasks/example_recurring_task.rb @@ -1,5 +1,6 @@ class ExampleRecurringTask include Delayed::RecurringJob + run_every 1.day run_at "11:00am" timezone "US/Pacific" diff --git a/spec/controllers/concerns/accessible_spec.rb b/spec/controllers/concerns/accessible_spec.rb index cb035b9f1d..932f0cd9eb 100644 --- a/spec/controllers/concerns/accessible_spec.rb +++ b/spec/controllers/concerns/accessible_spec.rb @@ -3,6 +3,7 @@ class MockController < ApplicationController before_action :reset_session, only: :no_session_action include Accessible + def action render plain: "controller action test..." end diff --git a/spec/models/case_court_report_spec.rb b/spec/models/case_court_report_spec.rb index 9ed0245197..ed2b2a36e7 100644 --- a/spec/models/case_court_report_spec.rb +++ b/spec/models/case_court_report_spec.rb @@ -5,6 +5,7 @@ RSpec.describe CaseCourtReport, type: :model do include DownloadHelpers + let(:path_to_template) { Rails.root.join("app/documents/templates/default_report_template.docx").to_s } let(:path_to_report) { Rails.root.join("tmp/test_report.docx").to_s } diff --git a/spec/requests/case_court_reports_spec.rb b/spec/requests/case_court_reports_spec.rb index 487819b8bf..7140babe7d 100644 --- a/spec/requests/case_court_reports_spec.rb +++ b/spec/requests/case_court_reports_spec.rb @@ -2,6 +2,7 @@ RSpec.describe "/case_court_reports", type: :request do include DownloadHelpers + let(:volunteer) { create(:volunteer, :with_cases_and_contacts, :with_assigned_supervisor) } before do diff --git a/spec/requests/court_dates_spec.rb b/spec/requests/court_dates_spec.rb index 38847e29bf..1774e3877d 100644 --- a/spec/requests/court_dates_spec.rb +++ b/spec/requests/court_dates_spec.rb @@ -2,6 +2,7 @@ RSpec.describe "/casa_cases/:casa_case_id/court_dates/:id", type: :request do include DownloadHelpers + let(:admin) { create(:casa_admin) } let(:casa_case) { court_date.casa_case } let(:court_date) { create(:court_date) }