Skip to content

Commit

Permalink
Update Ruby to 3.3 (#117)
Browse files Browse the repository at this point in the history
* Update ruby to 3.3

* Update sorbet, typhoeus, and ffi

* Update rake

* rake sorbet:update:all

* Update rubocop

* Rubocop -A

* Disable a rule

* erblint --lint-all -a

* rake sorbet:update:all

* Tweak a Rubocop rule to be compatible with Sorbet

* Fix a Sorbet error

* Update rubocop-factory_bot

* rake sorbet:update:all

* Add env var
  • Loading branch information
nathanmsmith authored Feb 1, 2024
1 parent 9cdade2 commit 5d56b88
Show file tree
Hide file tree
Showing 24 changed files with 5,049 additions and 3,324 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
TEST_COVERAGE: true
DATABASE_URL: 'postgres://postgres:test-password@localhost:5432/hotseat_test'
SEARCH_CLIENT: 'elasticsearch'
NOTIFICATION_TOKENS_PRICE: "price_12345"
services:
postgres:
image: postgres
Expand Down
5 changes: 5 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ Style/MethodCallWithArgsParentheses:
- '/**/Gemfile'
Style/StringLiterals:
EnforcedStyle: double_quotes
Style/ArgumentsForwarding:
UseAnonymousForwarding: false

Naming/VariableNumber:
Enabled: false
Expand Down Expand Up @@ -73,3 +75,6 @@ Minitest/EmptyLineBeforeAssertionMethods:
Enabled: false
Minitest/MultipleAssertions:
Enabled: false

FactoryBot/ExcessiveCreateList:
Enabled: false
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.4
3.3.0
55 changes: 28 additions & 27 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ GEM
concurrent-ruby (~> 1.1)
webrick (~> 1.7)
websocket-driver (>= 0.6, < 0.8)
ffi (1.15.5)
ffi (1.16.3)
ffi-compiler (1.0.1)
ffi (>= 1.0.0)
rake
Expand Down Expand Up @@ -244,7 +244,7 @@ GEM
jmespath (1.6.2)
jsbundling-rails (1.1.2)
railties (>= 6.0.0)
json (2.6.3)
json (2.7.1)
jwt (2.7.1)
kaminari (1.2.2)
activesupport (>= 4.1.0)
Expand Down Expand Up @@ -316,9 +316,8 @@ GEM
net-protocol
netrc (0.11.0)
nio4r (2.5.9)
nokogiri (1.15.3-arm64-darwin)
racc (~> 1.4)
nokogiri (1.15.3-x86_64-linux)
nokogiri (1.15.3)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nori (2.6.0)
noticed (1.6.3)
Expand Down Expand Up @@ -357,13 +356,13 @@ GEM
multi_json
openssl (3.1.0)
orm_adapter (0.5.0)
parallel (1.23.0)
parallel (1.24.0)
parlour (8.1.0)
commander (~> 4.5)
parser
rainbow (~> 3.0)
sorbet-runtime (>= 0.5)
parser (3.2.2.3)
parser (3.3.0.5)
ast (~> 2.4.1)
racc
pay (3.0.24)
Expand Down Expand Up @@ -399,7 +398,7 @@ GEM
public_suffix (5.0.3)
puma (5.6.6)
nio4r (~> 2.0)
racc (1.7.1)
racc (1.7.3)
rack (2.2.7)
rack-attack (6.6.1)
rack (>= 1.0, < 3)
Expand Down Expand Up @@ -441,7 +440,7 @@ GEM
thor (~> 1.0)
zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.0.6)
rake (13.1.0)
rbi (0.0.17)
ast
parser (>= 3.0.0)
Expand All @@ -450,31 +449,31 @@ GEM
redcarpet (3.6.0)
redis-client (0.14.1)
connection_pool
regexp_parser (2.8.1)
regexp_parser (2.9.0)
reline (0.3.6)
io-console (~> 0.5)
request_store (1.5.1)
rack (>= 1.4)
responders (3.1.0)
actionpack (>= 5.2)
railties (>= 5.2)
rexml (3.2.5)
rexml (3.2.6)
rotp (6.2.2)
rubocop (1.54.2)
rubocop (1.60.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.3)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.0, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0)
rubocop-ast (1.30.0)
parser (>= 3.2.1.0)
rubocop-factory_bot (2.23.1)
rubocop (~> 1.33)
rubocop-factory_bot (2.25.1)
rubocop (~> 1.41)
rubocop-minitest (0.31.0)
rubocop (>= 1.39, < 2.0)
rubocop-performance (1.18.0)
Expand Down Expand Up @@ -527,8 +526,8 @@ GEM
snaky_hash (2.0.1)
hashie
version_gem (~> 1.1, >= 1.1.1)
sorbet (0.5.10920)
sorbet-static (= 0.5.10920)
sorbet (0.5.11214)
sorbet-static (= 0.5.11214)
sorbet-coerce (0.7.0)
polyfill (~> 1.8)
safe_type (~> 1.1, >= 1.1.1)
Expand All @@ -539,12 +538,13 @@ GEM
parser (>= 2.7)
sorbet-coerce (>= 0.2.6)
sorbet-runtime (>= 0.5.9892)
sorbet-runtime (0.5.10920)
sorbet-static (0.5.10920-universal-darwin-22)
sorbet-static (0.5.10920-x86_64-linux)
sorbet-static-and-runtime (0.5.10920)
sorbet (= 0.5.10920)
sorbet-runtime (= 0.5.10920)
sorbet-runtime (0.5.11214)
sorbet-static (0.5.11214-universal-darwin)
sorbet-static (0.5.11214-universal-darwin-22)
sorbet-static (0.5.11214-x86_64-linux)
sorbet-static-and-runtime (0.5.11214)
sorbet (= 0.5.11214)
sorbet-runtime (= 0.5.11214)
spoom (1.2.2)
erubi (>= 1.10.0)
sorbet (>= 0.5.10187)
Expand All @@ -570,14 +570,14 @@ GEM
actionpack (>= 6.0.0)
activejob (>= 6.0.0)
railties (>= 6.0.0)
typhoeus (1.4.0)
typhoeus (1.4.1)
ethon (>= 0.9.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.8.2)
unicode-display_width (2.4.2)
unicode-display_width (2.5.0)
unparser (0.6.8)
diff-lcs (~> 1.3)
parser (>= 3.2.0)
Expand Down Expand Up @@ -611,6 +611,7 @@ GEM

PLATFORMS
arm64-darwin-22
arm64-darwin-23
x86_64-linux

DEPENDENCIES
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/reviews_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def index
typed_params = TypedParams.extract!(IndexParams, params)
page = typed_params.page

@reviews = Review.all.where(status: :pending).order(updated_at: :desc).page(page)
@reviews = Review.where(status: :pending).order(updated_at: :desc).page(page)
end

class ShowParams < T::Struct
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/subject_area_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class FilterOption < T::Enum
sig { params(subject_area: SubjectArea, current_option: T.any(FilterOption, Term), options: ActiveRecord::Relation).returns(T::Array[{ key: String, label: String, url: String, selected: T::Boolean }]) }
def self.filter_links(subject_area, current_option, options)
links = FilterOption.values.map do |value|
serialized_value = T.cast(value.serialize, String)
serialized_value = value.serialize
{
key: serialized_value,
label: serialized_value.titlecase,
Expand Down
2 changes: 1 addition & 1 deletion app/views/reviews/_question_buttons.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<% question_type.value_range.each do |i| %>
<div class="flex-1 flex flex-col items-center text-center text-sm">
<%= f.radio_button(question_id, i, class: "rating-radio", required:) %>
<%= f.label("#{question_id}_#{i}".to_sym, question_type.label_for_value(i)) %>
<%= f.label(:"#{question_id}_#{i}", question_type.label_for_value(i)) %>
</div>
<% end %>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace :data_migration do

Searchkick.disable_callbacks

Section.all.find_each do |section|
Section.find_each do |section|
Rails.logger.info("Section: #{section.id}, Section instructors: #{section.registrar_instructors}, Section instructor id: #{section.instructor_id}")
if (section.registrar_instructors == ["No instructor"]) || (section.registrar_instructors == ["No instructors"]) || (section.registrar_instructors == ["The Staff"])
Rails.logger.info("Section has no instructor")
Expand Down Expand Up @@ -45,7 +45,7 @@ namespace :data_migration do
end
end

orphaned_instructors = Instructor.all.where(registrar_listing: nil)
orphaned_instructors = Instructor.where(registrar_listing: nil)
Rails.logger.info("Orphaned instructors: #{orphaned_instructors.size}, deleting")
orphaned_instructors.destroy_all

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace :data_migration do
Rails.logger.level = :info

ActiveRecord::Base.transaction do
User.all.find_each do |user|
User.find_each do |user|
user.subscribe("announcements") unless user.subscribed?("announcements")
user.save
end
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/populate_instructors.rake
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace :populate do
end
Rails.logger.info("Using term #{term.readable}")

SubjectArea.all.find_each do |subject_area|
SubjectArea.find_each do |subject_area|
Rails.logger.info("Subject Area: #{subject_area.name}")
sections = Section.joins(:instructor, :course).where("courses.subject_area_id": subject_area)
Section.joins(:course).where(term:, "courses.subject_area_id": subject_area).find_each do |section|
Expand Down
Loading

0 comments on commit 5d56b88

Please sign in to comment.