Skip to content

Commit

Permalink
Merge pull request #4475 from DFE-Digital/dependabot/bundler/rubocop-…
Browse files Browse the repository at this point in the history
…rails-2.26.0

Bump rubocop-rails from 2.25.1 to 2.26.0
  • Loading branch information
avinhurry authored Aug 28, 2024
2 parents ccee365 + 686091a commit d0a7513
Show file tree
Hide file tree
Showing 14 changed files with 52 additions and 55 deletions.
10 changes: 5 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -500,10 +500,10 @@ GEM
os (1.1.4)
ostruct (0.6.0)
pagy (9.0.6)
parallel (1.25.1)
parallel (1.26.3)
parallel_tests (4.7.1)
parallel
parser (3.3.4.0)
parser (3.3.4.2)
ast (~> 2.4.1)
racc
patience_diff (1.2.0)
Expand Down Expand Up @@ -658,16 +658,16 @@ GEM
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.32.0)
rubocop-ast (1.32.1)
parser (>= 3.3.1.0)
rubocop-capybara (2.21.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.26.1)
rubocop (~> 1.61)
rubocop-rails (2.25.1)
rubocop-rails (2.26.0)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop (>= 1.52.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (3.0.4)
rubocop (~> 1.61)
Expand Down
2 changes: 1 addition & 1 deletion app/forms/support/school_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def full_address

return '' if address.all?(&:blank?)

address.select(&:present?).join('<br>').html_safe
address.compact_blank.join('<br>').html_safe
end

private
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/publish/school_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Publish
module SchoolHelper
def school_urn_and_location(school)
[school.town, school.postcode].select(&:present?).join(', ')
[school.town, school.postcode].compact_blank.join(', ')
end
end
end
2 changes: 1 addition & 1 deletion app/models/concerns/region_code.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module RegionCode
# These correspond to the first-level NUTS regions for the UK (minus Northern Ireland)
# https://en.wikipedia.org/wiki/First-level_NUTS_of_the_European_Union#United_Kingdom

enum region_code: {
enum :region_code, {
no_region: 0,
london: 1,
south_east: 2,
Expand Down
4 changes: 2 additions & 2 deletions app/models/concerns/with_qualifications.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module WithQualifications
#
# See [UCAS Teacher Training Set-up Guide](https://www.ucas.com/file/115581/download?token=mv-G6P53),
# page 32
enum profpost_flag: {
enum :profpost_flag, {

# Recommendation for QTS: the student will not receive an academic teacher
# training qualification on successful completion of the
Expand Down Expand Up @@ -41,7 +41,7 @@ module WithQualifications
# subjects this course was tagged to.
#
# Defined here: https://github.com/DFE-Digital/manage-courses-api/blob/master/src/ManageCourses.Domain/Models/CourseQualification.cs
enum qualification: { qts: 0, pgce_with_qts: 1, pgde_with_qts: 2, pgce: 3, pgde: 4, undergraduate_degree_with_qts: 5 }
enum :qualification, { qts: 0, pgce_with_qts: 1, pgde_with_qts: 2, pgce: 3, pgde: 4, undergraduate_degree_with_qts: 5 }

# This field may seem like an unnecessary overhead when there is already a
# database-backed `qualification` field. However it's misleading, from the
Expand Down
15 changes: 7 additions & 8 deletions app/models/contact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@ class Contact < ApplicationRecord
validates :telephone, phone: true, allow_nil: true
validates :permission_given, acceptance: true

enum type: {
admin: 'admin',
utt: 'utt',
web_link: 'web_link',
fraud: 'fraud',
finance: 'finance'
},
_suffix: 'contact'
enum :type, {
admin: 'admin',
utt: 'utt',
web_link: 'web_link',
fraud: 'fraud',
finance: 'finance'
}, suffix: 'contact'
end
20 changes: 10 additions & 10 deletions app/models/course.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,24 @@ class Course < ApplicationRecord
presence: true,
on: %i[create update]

enum application_status: {
enum :application_status, {
closed: 0,
open: 1
}, _prefix: :application_status
}, prefix: :application_status

enum course_type: {
enum :course_type, {
postgraduate: 'postgraduate',
undergraduate: 'undergraduate'
}, _suffix: :course_type
}, suffix: :course_type

enum funding: {
enum :funding, {
not_set: 'not_set',
fee: 'fee',
salary: 'salary',
apprenticeship: 'apprenticeship'
}

enum program_type: {
enum :program_type, {
higher_education_programme: 'HE',
higher_education_salaried_programme: 'HES',
school_direct_training_programme: 'SD',
Expand All @@ -65,19 +65,19 @@ class Course < ApplicationRecord
teacher_degree_apprenticeship: 'TDA'
}

enum study_mode: {
enum :study_mode, {
full_time: 'F',
part_time: 'P',
full_time_or_part_time: 'B'
}

enum level: {
enum :level, {
primary: 'Primary',
secondary: 'Secondary',
further_education: 'Further education'
}, _suffix: :course
}, suffix: :course

enum degree_grade: {
enum :degree_grade, {
two_one: 0,
two_two: 1,
third_class: 2,
Expand Down
2 changes: 1 addition & 1 deletion app/models/course_enrichment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class CourseEnrichment < ApplicationRecord
include TouchCourse
include RecruitmentCycleHelper
enum status: { draft: 0, published: 1, rolled_over: 2, withdrawn: 3 }
enum :status, { draft: 0, published: 1, rolled_over: 2, withdrawn: 3 }

jsonb_accessor :json_data,
about_course: [:string, { store_key: 'AboutCourse' }],
Expand Down
6 changes: 3 additions & 3 deletions app/models/provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ class Provider < ApplicationRecord
# The `scitt` & `university` provider types can be used to denote
# that they are an `accredited_provider` for accrediting providers
# therefore `lead_school` is a `not_an_accredited_provider`.
enum provider_type: {
enum :provider_type, {
scitt: 'B',
lead_school: 'Y',
university: 'O'
}

enum accrediting_provider: {
enum :accrediting_provider, {
accredited_provider: 'Y',
not_an_accredited_provider: 'N'
}
Expand Down Expand Up @@ -223,7 +223,7 @@ def full_address
end

def full_address_with_breaks
[address1, address2, address3, town, address4, postcode].map { |line| ERB::Util.html_escape(line) }.select(&:present?).join('<br> ').html_safe
[address1, address2, address3, town, address4, postcode].map { |line| ERB::Util.html_escape(line) }.compact_blank.join('<br> ').html_safe
end

def address_changed?
Expand Down
26 changes: 12 additions & 14 deletions app/models/provider_ucas_preference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,19 @@
class ProviderUCASPreference < ApplicationRecord
belongs_to :provider

enum type_of_gt12: {
coming_or_not: 'Coming or Not',
coming_enrol: 'Coming / Enrol',
not_coming: 'Not coming',
no_response: 'No response'
},
_prefix: 'type_of_gt12'
enum :type_of_gt12, {
coming_or_not: 'Coming or Not',
coming_enrol: 'Coming / Enrol',
not_coming: 'Not coming',
no_response: 'No response'
}, prefix: 'type_of_gt12'

enum send_application_alerts: {
all: 'Yes, required',
none: 'No, not required',
my_programmes: 'Yes - only my programmes',
accredited_programmes: 'Yes - for accredited programmes only'
},
_prefix: 'send_application_alerts_for'
enum :send_application_alerts, {
all: 'Yes, required',
none: 'No, not required',
my_programmes: 'Yes - only my programmes',
accredited_programmes: 'Yes - for accredited programmes only'
}, prefix: 'send_application_alerts_for'

def gt12_contact=(gt12_contact)
update(gt12_response_destination: gt12_contact)
Expand Down
4 changes: 2 additions & 2 deletions app/models/site.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Site < ApplicationRecord

belongs_to :provider

enum site_type: {
enum :site_type, {
school: 0,
study_site: 1
}
Expand Down Expand Up @@ -72,7 +72,7 @@ def full_address

return '' if address.all?(&:blank?)

address.select(&:present?).join(', ')
address.compact_blank.join(', ')
end

def address_changed?
Expand Down
10 changes: 5 additions & 5 deletions app/models/site_status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@ class SiteStatus < ApplicationRecord
validate :vac_status_must_be_consistent_with_course_study_mode,
if: proc { |s| s.course&.study_mode.present? }

enum vac_status: {
enum :vac_status, {
both_full_time_and_part_time_vacancies: 'B',
part_time_vacancies: 'P',
full_time_vacancies: 'F',
no_vacancies: ''
}

enum status: {
enum :status, {
discontinued: 'D',
running: 'R',
new_status: 'N',
suspended: 'S'
}, _prefix: :status
}, prefix: :status

enum publish: {
enum :publish, {
published: 'Y',
unpublished: 'N'
}, _suffix: :on_ucas
}, suffix: :on_ucas

aasm column: :status, enum: true do
state :new_status, initial: true
Expand Down
2 changes: 1 addition & 1 deletion app/view_objects/find/results_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def nearest_address(course)
nearest_address.town,
nearest_address.address4,
nearest_address.postcode
].select(&:present?).join(', ').html_safe
].compact_blank.join(', ').html_safe
end

def nearest_location_name(course)
Expand Down
2 changes: 1 addition & 1 deletion spec/swagger_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# the root example_group in your specs, e.g. describe '...', swagger_doc: 'v2/swagger.json'
swagger_v1_template = YAML.load_file(Rails.root.join('swagger/public_v1/template.yml'))
swagger_v1_template['components']['schemas'] ||= {}
additional_component_schemas = Dir[Rails.root.join('swagger/public_v1/component_schemas/*.yml')].to_h do |path|
additional_component_schemas = Rails.root.glob('swagger/public_v1/component_schemas/*.yml').to_h do |path|
component_name = File.basename(path, '.yml')
[component_name, YAML.load_file(path)]
end
Expand Down

0 comments on commit d0a7513

Please sign in to comment.