Skip to content

Commit

Permalink
release/FY25Q1.3.0 (#23456) (#23475)
Browse files Browse the repository at this point in the history
* 🔀 Squash merge jcroteau/APPEALS-54136-zeitwerk-autoloader-transition

* 🔀 Squash merge jcroteau/APPEALS-60112-fix-db-migrate-up-and-down-tasks

Co-authored-by: Jeremy Croteau <[email protected]>
  • Loading branch information
sbashamoni and jcroteau authored Nov 14, 2024
1 parent 57e0f68 commit 5e0f952
Show file tree
Hide file tree
Showing 144 changed files with 806 additions and 648 deletions.
37 changes: 23 additions & 14 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ checks:
plugins:
brakeman:
enabled: true
exclude_patterns:
- 'lib/helpers/war_room/DtaDooDescriptionRemediationByReportLoad.rb'
bundler-audit:
enabled: true
duplication:
Expand All @@ -51,13 +53,13 @@ plugins:
javascript:
mass_threshold: 81
exclude_patterns:
- 'db/migrate/*'
- 'db/etl_migrate/*'
- 'app/controllers/idt/api/v2/appeals_controller.rb'
- 'spec/controllers/idt/api/v2/appeals_controller_spec.rb'
- 'db/etl_migrate/*'
- 'db/migrate/*'
- 'spec/controllers/decision_reviews_controller_spec.rb'
- 'spec/controllers/idt/api/appeals_controller_spec.rb'
- 'spec/controllers/idt/api/v2/appeals_controller_spec.rb'
- 'spec/controllers/tasks_controller_spec.rb'
- 'spec/controllers/decision_reviews_controller_spec.rb'
- 'spec/models/hearings/conference_link_spec.rb'
eslint:
enabled: true
Expand All @@ -79,10 +81,18 @@ plugins:
Attribute:
enabled: false
exclude_patterns:
- 'db/migrate/*'
- 'db/etl_migrate/*'
- 'app/jobs/dispatch_email_job.rb'
- 'app/mailers/dispatch_mailer.rb'
- 'db/etl_migrate/*'
- 'db/migrate/*'
- 'lib/helpers/sanitizers.rb'
- 'lib/helpers/war_room/claim_label_change.rb'
- 'lib/helpers/war_room/DtaDooDescriptionRemediationByReportLoad.rb'
- 'lib/helpers/war_room/dupp_ep_claims_sync_status_update_can_clr.rb'
- 'lib/helpers/war_room/hearings_info_migration.rb'
- 'lib/helpers/war_room/payee_code_update.rb'
- 'lib/helpers/war_room/remand_dta_or_doo_higher_level_review.rb'
- 'lib/helpers/war_room/report_load_end_product_sync.rb'
rubocop:
enabled: true
channel: rubocop-0-83
Expand Down Expand Up @@ -116,15 +126,14 @@ plugins:
- "spec/feature/**/*.rb"

exclude_patterns:
- 'db/schema.rb'
- 'db/etl_schema.rb'
- 'db/seeds.rb'
- 'db/scripts/*'
- 'node_modules/**/*'
- 'app/mappers/zip_code_to_lat_lng_mapper.rb'
- 'tmp/**/*'
- 'app/assets/**/*'
- 'client/test/data/camoQueueConfigData.js'
- 'client/app/intake/components/mockData/issueListProps.js'
- 'client/test/data/camoQueueConfigData.js'
- 'db/etl_schema.rb'
- 'db/schema.rb'
- 'db/scripts/*'
- 'db/seeds.rb'
- 'db/seeds/*'

- 'node_modules/**/*'
- 'tmp/**/*'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ tags
!.dockerignore
!.fasterer.yml
!.reek.yml
!.rubocop
!/.circleci/config.yml

# React on Rails
Expand Down
15 changes: 12 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require:
- rubocop-performance
- rubocop-rails
- .rubocop/custom_cop/top_level_constants_per_file.rb

AllCops:
Exclude:
Expand Down Expand Up @@ -102,9 +103,9 @@ Metrics/MethodLength:
Max: 20
Exclude:
- app/jobs/middleware/job_sentry_scope_middleware.rb
- lib/helpers/unrecognized_appellant.rb
- lib/helpers/war_room/unrecognized_appellant.rb
- lib/helpers/duplicate_veteran_checker.rb
- lib/helpers/report_load_end_product_sync.rb
- lib/helpers/war_room/report_load_end_product_sync.rb
- lib/helpers/claim_label_change.rb
- "spec/**/*"

Expand Down Expand Up @@ -213,7 +214,7 @@ Layout/LineLength:
Max: 120
Exclude:
- lib/helpers/duplicate_veteran_checker.rb
- lib/helpers/report_load_end_product_sync.rb
- lib/helpers/war_room/report_load_end_product_sync.rb


Layout/MultilineMethodCallIndentation:
Expand All @@ -224,3 +225,11 @@ Layout/EmptyLinesAroundAttributeAccessor:

Layout/SpaceAroundMethodCallOperator:
Enabled: true

CustomCop/TopLevelConstantsPerFile:
Enabled: true
Include:
- 'app/**/*'
- 'lib/**/*'
Exclude:
- '**/*[^.rb]' # exclude non-.rb files (ex: .rake files)
30 changes: 30 additions & 0 deletions .rubocop/custom_cop/top_level_constants_per_file.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# frozen_string_literal: true

module RuboCop
module CustomCop
class TopLevelConstantsPerFile < RuboCop::Cop::Cop
MSG = "Multiple top-level constants detected in one file. The autoloader expects one top-level constant per file."

def investigate(processed_source)
return unless processed_source

# If more than one top-level constant in the file, add offense on the second one
if top_level_constant_nodes.size > 1
add_offense(top_level_constant_nodes[1], message: MSG)
end
end

private

def top_level_constant_nodes
@top_level_constant_nodes ||=
processed_source.ast.each_node(:class, :module).select { |node| top_level_constant?(node) }
end

def top_level_constant?(node)
# node is not nested within a class or module node?
node.ancestors.none? { |ancestor| ancestor.class_type? || ancestor.module_type? }
end
end
end
end
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ gem "bgs", git: "https://github.com/department-of-veterans-affairs/ruby-bgs.git"
gem "bootsnap", require: false
gem "browser"
gem "business_time", "~> 0.9.3"
gem "caseflow", git: "https://github.com/department-of-veterans-affairs/caseflow-commons", ref: "9bd3635fbd8094d25160669f38d8699e2f1d7a98"
gem "caseflow", git: "https://github.com/department-of-veterans-affairs/caseflow-commons", ref: "dbd86859856d161d84b0bba4d67a8b62e4684996"
gem "connect_mpi", git: "https://github.com/department-of-veterans-affairs/connect-mpi.git", ref: "a3a58c64f85b980a8b5ea6347430dd73a99ea74c"
gem "connect_vbms", git: "https://github.com/department-of-veterans-affairs/connect_vbms.git", ref: "9807d9c9f0f3e3494a60b6693dc4f455c1e3e922"
gem "console_tree_renderer", git: "https://github.com/department-of-veterans-affairs/console-tree-renderer.git", tag: "v0.1.1"
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GIT
remote: https://github.com/department-of-veterans-affairs/caseflow-commons
revision: 9bd3635fbd8094d25160669f38d8699e2f1d7a98
ref: 9bd3635fbd8094d25160669f38d8699e2f1d7a98
revision: dbd86859856d161d84b0bba4d67a8b62e4684996
ref: dbd86859856d161d84b0bba4d67a8b62e4684996
specs:
caseflow (0.4.8)
aws-sdk-s3
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/api/v3/issues/vacols/veterans_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

# :reek:InstanceVariableAssumption
class Api::V3::Issues::Vacols::VeteransController < Api::V3::BaseController
class Api::V3::Issues::VACOLS::VeteransController < Api::V3::BaseController
# The max amount of Issues that can be paginated on a single page
DEFAULT_UPPER_BOUND_PER_PAGE = ENV["REQUEST_ISSUE_DEFAULT_UPPER_BOUND_PER_PAGE"].to_i
include ApiV3FeatureToggleConcern
Expand Down Expand Up @@ -56,7 +56,7 @@ def show
# Disallow page(0) since page(0) == page(1) in kaminari. This is to avoid confusion.
(page.nil? || page <= 0) ? page = 1 : page ||= 1

render_vacols_issues(Api::V3::Issues::Vacols::VbmsVacolsDtoBuilder.new(@veteran, page,
render_vacols_issues(Api::V3::Issues::VACOLS::VbmsVacolsDtoBuilder.new(@veteran, page,
per_page))
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Hearings::ScheduleHearingTasksController < ApplicationController
before_action :verify_edit_hearing_schedule_access

def index
task_pager = Hearings::ScheduleHearingTaskPager.new(
task_pager = ScheduleHearingTaskPager.new(
assignee: HearingsManagement.singleton,
tab_name: allowed_params[Constants.QUEUE_CONFIG.TAB_NAME_REQUEST_PARAM],
page: allowed_params[Constants.QUEUE_CONFIG.PAGE_NUMBER_REQUEST_PARAM].to_i,
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion app/controllers/user_info_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class UserInfoController < ApplicationController
include BgsService
include BGSServiceConcern

before_action :deny_non_bva_admins, only: [:represented_organizations]

Expand Down
7 changes: 0 additions & 7 deletions app/exceptions/standard_error.rb

This file was deleted.

2 changes: 0 additions & 2 deletions app/jobs/application_job.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require_relative "../exceptions/standard_error"

class ApplicationJob < ActiveJob::Base
class InvalidJobPriority < StandardError; end

Expand Down
23 changes: 9 additions & 14 deletions app/jobs/file_number_not_found_fix_job.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
# frozen_string_literal: true

require_relative "../../lib/helpers/fix_file_number_wizard"
require_relative "../../lib/helpers/duplicate_veteran_checker"

class FileNumberNotFoundFixJob < CaseflowJob
include MasterSchedulerInterface
ASSOCIATED_OBJECTS = FixFileNumberWizard::ASSOCIATIONS

queue_with_priority :low_priority
application_attr :intake

class FixfileNumberCollections
ASSOCIATED_OBJECTS = FixFileNumberWizard::ASSOCIATIONS
def self.get_collections(veteran)
ASSOCIATED_OBJECTS.map do |klass|
FixFileNumberWizard::Collection.new(klass, veteran.ssn)
end
end
end

def initialize
@stuck_job_report_service = StuckJobReportService.new
@start_time = nil
Expand Down Expand Up @@ -109,13 +114,3 @@ def self.call(ssn)
end
end
end

# created this class below so as to mock FixFileNumberWizard::Collection instance
class FixfileNumberCollections
ASSOCIATED_OBJECTS = FixFileNumberWizard::ASSOCIATIONS
def self.get_collections(veteran)
ASSOCIATED_OBJECTS.map do |klass|
FixFileNumberWizard::Collection.new(klass, veteran.ssn)
end
end
end
2 changes: 1 addition & 1 deletion app/models/appeal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# rubocop:disable Metrics/ClassLength
class Appeal < DecisionReview
include BeaamAppealConcern
include BgsService
include BGSServiceConcern
include Taskable
include PrintsTaskTree
include HasTaskHistory
Expand Down
2 changes: 1 addition & 1 deletion app/models/bgs_attorney.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# who might not already be associated with a record (hence the use of a different model/table)

class BgsAttorney < CaseflowRecord
include BgsService
include BGSServiceConcern

delegate :address,
:address_line_1,
Expand Down
2 changes: 1 addition & 1 deletion app/models/bgs_power_of_attorney.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class BgsPowerOfAttorney < CaseflowRecord
include AssociatedBgsRecord
include BgsService
include BGSServiceConcern

has_many :claimants, primary_key: :claimant_participant_id, foreign_key: :participant_id
has_one :representative, primary_key: :poa_participant_id, foreign_key: :participant_id
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/appeal_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def accessible?
# this is used for calling BGSService.can_access? to fix VSO access that is being blocked
# by BGS returning false for veteran.accessible? when they should indeed have access to the appeal.
# does this VSO have access to this appeal? check if current user is one of the reps on the appeal.
# if so return true, if not then do the BgsService.can_access? path.
# if so return true, if not then do the BGSService.can_access? path.
user = RequestStore[:current_user]
assigned_to_vso?(user) || user_represents_claimant_not_veteran?(user) || bgs.can_access?(veteran_file_number)
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/associated_bgs_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module AssociatedBgsRecord
extend ActiveSupport::Concern

include BgsService
include BGSServiceConcern

module ClassMethods
# bgs_attr_accessor will lazy load the underlying data from BGS upon first call
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

module BgsService
module BGSServiceConcern
extend ActiveSupport::Concern

private
Expand Down
2 changes: 1 addition & 1 deletion app/models/end_product_update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# This is for updating the claim label for end products established from Caseflow

class EndProductUpdate < CaseflowRecord
include BgsService
include BGSServiceConcern

belongs_to :end_product_establishment, optional: false
belongs_to :original_decision_review, polymorphic: true, optional: false
Expand Down
2 changes: 1 addition & 1 deletion app/models/hearings/schedule_hearing_task_pager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
##
# Basically the TaskPager, but has a required filter by regional key.

class Hearings::ScheduleHearingTaskPager < TaskPager
class ScheduleHearingTaskPager < TaskPager
attr_accessor :regional_office_key

def initialize(args)
Expand Down
2 changes: 1 addition & 1 deletion app/models/legacy_appeal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class LegacyAppeal < CaseflowRecord
include AppealConcern
include AssociatedVacolsModel
include BgsService
include BGSServiceConcern
include CachedAttributes
include AddressMapper
include Taskable
Expand Down
1 change: 0 additions & 1 deletion app/models/organization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ class Organization < CaseflowRecord
has_many :users, through: :organizations_users
has_many :membership_requests
has_many :non_admin_users, -> { non_admin }, class_name: "OrganizationsUser"
require_dependency "dvc_team"

validates :name, presence: true
validates :url, presence: true, uniqueness: true
Expand Down
2 changes: 0 additions & 2 deletions app/models/organizations/business_line.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1085,5 +1085,3 @@ def where_clause_from_array(table_class, column, values_array)
end
# rubocop:enable Metrics/ClassLength
end

require_dependency "vha_business_line"
2 changes: 1 addition & 1 deletion app/models/person.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class Person < CaseflowRecord
include AssociatedBgsRecord
include BgsService
include BGSServiceConcern
include EventConcern

has_many :advance_on_docket_motions
Expand Down
2 changes: 1 addition & 1 deletion app/models/power_of_attorney.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class PowerOfAttorney
include ActiveModel::Model
include AssociatedVacolsModel
include BgsService
include BGSServiceConcern

vacols_attr_accessor :vacols_representative_type,
:vacols_representative_name,
Expand Down
9 changes: 0 additions & 9 deletions app/models/queue_tab.rb
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,3 @@ def assignee_is_organization
errors.add(:assignee, COPY::QUEUE_TAB_NON_ORGANIZATION_ASSIGNEE_MESSAGE) unless assignee.is_a?(Organization)
end
end

require_dependency "assigned_tasks_tab"
require_dependency "completed_tasks_tab"
require_dependency "on_hold_tasks_tab"
require_dependency "organization_assigned_tasks_tab"
require_dependency "organization_completed_tasks_tab"
require_dependency "organization_on_hold_tasks_tab"
require_dependency "organization_tracking_tasks_tab"
require_dependency "organization_unassigned_tasks_tab"
Loading

0 comments on commit 5e0f952

Please sign in to comment.