Skip to content

Commit

Permalink
Use Sorbet
Browse files Browse the repository at this point in the history
  • Loading branch information
gmcgibbon committed Feb 19, 2024
1 parent dd1b588 commit d73c415
Show file tree
Hide file tree
Showing 316 changed files with 290,912 additions and 8 deletions.
8 changes: 8 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@ inherit_from:
require:
- rubocop-rails
- rubocop-capybara
- rubocop-sorbet

AllCops:
TargetRubyVersion: 3.3.0
Exclude:
- bin/bundle

Style/ClassAndModuleChildren:
Exclude:
- sorbet

Sorbet/TrueSigil:
Enabled: true
14 changes: 10 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ group :development do
gem "rack-mini-profiler", "~> 2.0"
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem "spring"
# Ruby LSP features for Rails
gem "ruby-lsp-rails"
# Code linting
gem "rubocop", require: false
gem "rubocop-capybara"
gem "rubocop-rails", require: false
gem "rubocop-sorbet", require: false
gem "sorbet", require: false
gem "tapioca", require: false
end

group :test do
Expand All @@ -60,10 +69,7 @@ gem "view_component"
# Blog engine
gem "blog", path: "blog"

# Code linting
gem "rubocop", require: false
gem "rubocop-capybara"
gem "rubocop-rails", require: false
gem "sorbet-runtime"

gem "tailwindcss-rails"

Expand Down
50 changes: 50 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ GEM
timeout
net-smtp (0.4.0)
net-protocol
netrc (0.11.0)
nio4r (2.7.0)
nokogiri (1.15.5)
mini_portile2 (~> 2.8.2)
Expand All @@ -196,6 +197,8 @@ GEM
parser (3.2.2.4)
ast (~> 2.4.1)
racc
prettier_print (1.2.1)
prism (0.19.0)
psych (5.1.2)
stringio
public_suffix (4.0.6)
Expand All @@ -221,6 +224,9 @@ GEM
nokogiri (~> 1.14)
rainbow (3.1.1)
rake (13.1.0)
rbi (0.1.6)
prism (>= 0.18.0, < 0.20)
sorbet-runtime (>= 0.5.9204)
rdoc (6.6.2)
psych (>= 4.0.0)
redcarpet (3.6.0)
Expand All @@ -247,6 +253,18 @@ GEM
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-sorbet (0.7.7)
rubocop (>= 0.90.0)
ruby-lsp (0.13.4)
language_server-protocol (~> 3.17.0)
prism (>= 0.19.0, < 0.20)
sorbet-runtime (>= 0.5.10782)
ruby-lsp-rails (0.2.8)
actionpack (>= 6.0)
activerecord (>= 6.0)
railties (>= 6.0)
ruby-lsp (>= 0.13.0, < 0.14.0)
sorbet-runtime (>= 0.5.9897)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
Expand All @@ -255,6 +273,18 @@ GEM
rexml (~> 3.2)
rubyzip (>= 1.2.2)
websocket (~> 1.0)
sorbet (0.5.11190)
sorbet-static (= 0.5.11190)
sorbet-runtime (0.5.11190)
sorbet-static (0.5.11190-universal-darwin)
sorbet-static-and-runtime (0.5.11190)
sorbet (= 0.5.11190)
sorbet-runtime (= 0.5.11190)
spoom (1.2.4)
erubi (>= 1.10.0)
sorbet-static-and-runtime (>= 0.5.10187)
syntax_tree (>= 6.1.1)
thor (>= 0.19.2)
spring (4.0.0)
sprockets (4.0.2)
concurrent-ruby (~> 1.0)
Expand All @@ -266,10 +296,21 @@ GEM
stimulus-rails (1.3.0)
railties (>= 6.0.0)
stringio (3.1.0)
syntax_tree (6.2.0)
prettier_print (>= 1.2.0)
tailwindcss-rails (2.1.0-x86_64-darwin)
railties (>= 6.0.0)
tailwindcss-rails (2.1.0-x86_64-linux)
railties (>= 6.0.0)
tapioca (0.11.15)
bundler (>= 2.2.25)
netrc (>= 0.11.0)
parallel (>= 1.21.0)
rbi (>= 0.1.4, < 0.2)
sorbet-static-and-runtime (>= 0.5.10820)
spoom (~> 1.2.0, >= 1.2.0)
thor (>= 1.2.0)
yard-sorbet
thor (1.3.0)
timeout (0.4.1)
turbo-rails (1.5.0)
Expand Down Expand Up @@ -299,6 +340,10 @@ GEM
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
yard (0.9.34)
yard-sorbet (0.8.1)
sorbet-runtime (>= 0.5)
yard (>= 0.9)
zeitwerk (2.6.12)

PLATFORMS
Expand All @@ -322,11 +367,16 @@ DEPENDENCIES
rubocop
rubocop-capybara
rubocop-rails
rubocop-sorbet
ruby-lsp-rails
selenium-webdriver (= 4.0.0.beta3)
sorbet
sorbet-runtime
spring
sprockets-rails
stimulus-rails
tailwindcss-rails
tapioca
turbo-rails
tzinfo-data
view_component
Expand Down
1 change: 1 addition & 0 deletions app/components/application_component.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

class ApplicationComponent < ViewComponent::Base
Expand Down
1 change: 1 addition & 0 deletions app/components/application_page_component.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

class ApplicationPageComponent < ApplicationComponent
Expand Down
1 change: 1 addition & 0 deletions app/components/footer_component.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

class FooterComponent < ApplicationComponent
Expand Down
1 change: 1 addition & 0 deletions app/components/header_component.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

class HeaderComponent < ApplicationComponent
Expand Down
1 change: 1 addition & 0 deletions app/components/talk_list_component.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

class TalkListComponent < ApplicationComponent
Expand Down
1 change: 1 addition & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

class ApplicationController < ActionController::Base
Expand Down
1 change: 1 addition & 0 deletions app/controllers/talks_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

class TalksController < ApplicationController
Expand Down
1 change: 1 addition & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module ApplicationHelper
Expand Down
1 change: 1 addition & 0 deletions app/helpers/talks_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module TalksHelper
Expand Down
2 changes: 2 additions & 0 deletions app/models/application_record.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# typed: true
# frozen_string_literal: true

class ApplicationRecord < FrozenRecord::Base
self.base_path = Rails.root.join("db")
self.auto_reloading = true
self.abstract_class = true

add_index(:id, unique: true)
end
1 change: 1 addition & 0 deletions app/models/talk.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

class Talk < ApplicationRecord
Expand Down
27 changes: 27 additions & 0 deletions bin/rubocop
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'rubocop' is installed as part of a gem, and
# this file is here to facilitate running it.
#

ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)

bundle_binstub = File.expand_path("bundle", __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

load Gem.bin_path("rubocop", "rubocop")
27 changes: 27 additions & 0 deletions bin/srb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'srb' is installed as part of a gem, and
# this file is here to facilitate running it.
#

ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)

bundle_binstub = File.expand_path("bundle", __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

load Gem.bin_path("sorbet", "srb")
27 changes: 27 additions & 0 deletions bin/tapioca
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'tapioca' is installed as part of a gem, and
# this file is here to facilitate running it.
#

ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)

bundle_binstub = File.expand_path("bundle", __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

load Gem.bin_path("tapioca", "tapioca")
2 changes: 2 additions & 0 deletions blog/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ gem "importmap-rails"

gem "actionpack-action_caching"
gem "rails", github: "rails/rails"

gem "sorbet-runtime"
2 changes: 2 additions & 0 deletions blog/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ GEM
reline (0.4.1)
io-console (~> 0.5)
ruby2_keywords (0.0.5)
sorbet-runtime (0.5.11247)
sprockets (4.0.3)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
Expand Down Expand Up @@ -251,6 +252,7 @@ DEPENDENCIES
capybara
importmap-rails
rails!
sorbet-runtime

BUNDLED WITH
2.4.20
3 changes: 2 additions & 1 deletion blog/app/components/blog/application_component.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# typed: true
# frozen_string_literal: true

module Blog
class ApplicationComponent < ::ApplicationComponent
include(Engine.routes.url_helpers)
T.unsafe(self).include(Engine.routes.url_helpers)
end
end
1 change: 1 addition & 0 deletions blog/app/components/blog/article_component.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Blog
Expand Down
1 change: 1 addition & 0 deletions blog/app/components/blog/article_list_component.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Blog
Expand Down
1 change: 1 addition & 0 deletions blog/app/controllers/blog/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Blog
Expand Down
1 change: 1 addition & 0 deletions blog/app/controllers/blog/articles_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Blog
Expand Down
1 change: 1 addition & 0 deletions blog/app/helpers/blog/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Blog
Expand Down
1 change: 1 addition & 0 deletions blog/app/helpers/blog/articles_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Blog
Expand Down
2 changes: 2 additions & 0 deletions blog/app/models/blog/application_record.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# typed: true
# frozen_string_literal: true

module Blog
class ApplicationRecord < FrozenRecord::Base
self.base_path = Engine.root.join("db")
self.auto_reloading = true
self.abstract_class = true

add_index(:id, unique: true)
end
Expand Down
1 change: 1 addition & 0 deletions blog/app/models/blog/article.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Blog
Expand Down
1 change: 1 addition & 0 deletions blog/app/models/blog/author.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Blog
Expand Down
1 change: 1 addition & 0 deletions blog/config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

Blog::Engine.routes.draw do
Expand Down
1 change: 1 addition & 0 deletions blog/lib/blog.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

require "yaml"
Expand Down
Loading

0 comments on commit d73c415

Please sign in to comment.