Skip to content

Commit

Permalink
Stop accidentally relying on untyped objects (#69)
Browse files Browse the repository at this point in the history
From sorbet/sorbet#7038, the return type from `self.class` in a module
that uses `mixes_in_class_methods` is untyped.

To get better type coverage, I am removing most uses of `self.class` in
the library. This also allows me to stop relying on `include Kernel` in
the various `Interfaces`, and to start treating the protocol objects as
proper singletons.

These changes do not affect any public APIs, so there is no version
change.

Resolves #69
  • Loading branch information
bannable authored Nov 18, 2023
1 parent 0b16f62 commit 2602c22
Show file tree
Hide file tree
Showing 75 changed files with 43,429 additions and 4,323 deletions.
8 changes: 4 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ gem 'rake', '~> 13'
gem 'reek'
gem 'rspec', '~> 3'
gem 'rspec_junit_formatter'
gem 'rubocop', '~> 1.54.2'
gem 'rubocop-performance', '~> 1.18.0'
gem 'rubocop-rspec', '~> 2.22.0'
gem 'rubocop-sorbet', '~> 0.7.3'
gem 'rubocop', '~> 1.57'
gem 'rubocop-performance', '~> 1.18'
gem 'rubocop-rspec', '~> 2.22'
gem 'rubocop-sorbet', '~> 0.7'
gem 'simplecov', '~> 0'
gem 'simplecov_json_formatter'
gem 'sorbet', '~> 0'
Expand Down
20 changes: 10 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ GEM
parser
rainbow (~> 3.0)
sorbet-runtime (>= 0.5)
parser (3.2.2.3)
parser (3.2.2.4)
ast (~> 2.4.1)
racc
prettier_print (1.2.1)
Expand All @@ -67,7 +67,7 @@ GEM
regexp_parser (2.8.1)
reline (0.3.3)
io-console (~> 0.5)
rexml (3.2.6)
rexml (3.2.5)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
Expand All @@ -83,15 +83,15 @@ GEM
rspec-support (3.12.0)
rspec_junit_formatter (0.6.0)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (1.54.2)
rubocop (1.57.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.3)
parser (>= 3.2.2.4)
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.28.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0)
Expand All @@ -107,7 +107,7 @@ GEM
rubocop (~> 1.33)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
rubocop-sorbet (0.7.3)
rubocop-sorbet (0.7.0)
rubocop (>= 0.90.0)
ruby-progressbar (1.13.0)
simplecov (0.22.0)
Expand Down Expand Up @@ -166,10 +166,10 @@ DEPENDENCIES
reek
rspec (~> 3)
rspec_junit_formatter
rubocop (~> 1.54.2)
rubocop-performance (~> 1.18.0)
rubocop-rspec (~> 2.22.0)
rubocop-sorbet (~> 0.7.3)
rubocop (~> 1.57)
rubocop-performance (~> 1.18)
rubocop-rspec (~> 2.22)
rubocop-sorbet (~> 0.7)
ruby-paseto!
simplecov (~> 0)
simplecov_json_formatter
Expand Down
4 changes: 1 addition & 3 deletions devcontainers/bullseye/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
"customizations": {
"vscode": {
"extensions": [
"rebornix.Ruby",
"Shopify.ruby-lsp",
"sorbet.sorbet-vscode-extension",
"castwide.solargraph",
"yzhang.markdown-all-in-one",
"eamodio.gitlens",
"KoichiSasada.vscode-rdbg"
Expand All @@ -29,7 +28,6 @@
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

"onCreateCommand": "gem install solargraph --no-document",
"postCreateCommand": "bin/setup",

"remoteUser": "vscode"
Expand Down
4 changes: 1 addition & 3 deletions devcontainers/jammy/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@
"customizations": {
"vscode": {
"extensions": [
"rebornix.Ruby",
"Shopify.ruby-lsp",
"sorbet.sorbet-vscode-extension",
"castwide.solargraph",
"yzhang.markdown-all-in-one",
"eamodio.gitlens",
"KoichiSasada.vscode-rdbg"
Expand All @@ -36,7 +35,6 @@
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

"onCreateCommand": "gem install solargraph --no-document",
"postCreateCommand": "bin/setup",

"remoteUser": "vscode"
Expand Down
8 changes: 4 additions & 4 deletions gemfiles/openssl_3.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ gem "rake", "~> 13"
gem "reek"
gem "rspec", "~> 3"
gem "rspec_junit_formatter"
gem "rubocop", "~> 1.54.2"
gem "rubocop-performance", "~> 1.18.0"
gem "rubocop-rspec", "~> 2.22.0"
gem "rubocop-sorbet", "~> 0.7.0"
gem "rubocop", "~> 1.57"
gem "rubocop-performance", "~> 1.18"
gem "rubocop-rspec", "~> 2.22"
gem "rubocop-sorbet", "~> 0.7"
gem "simplecov", "~> 0"
gem "simplecov_json_formatter"
gem "sorbet", "~> 0"
Expand Down
56 changes: 28 additions & 28 deletions gemfiles/openssl_3.0.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ GEM
kwalify (0.7.2)
language_server-protocol (3.17.0.3)
multi_json (1.15.0)
oj (3.15.0)
oj (3.16.1)
openssl (3.0.2)
parallel (1.23.0)
parallel_tests (4.2.1)
parallel_tests (4.3.0)
parallel
parser (3.2.2.3)
parser (3.2.2.4)
ast (~> 2.4.1)
racc
racc (1.7.1)
racc (1.7.3)
rainbow (3.1.1)
rake (13.0.6)
rake (13.1.0)
reek (6.1.4)
kwalify (~> 0.7.0)
parser (~> 3.2.0)
rainbow (>= 2.0, < 4.0)
regexp_parser (2.8.1)
rexml (3.2.5)
regexp_parser (2.8.2)
rexml (3.2.6)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
Expand All @@ -49,31 +49,31 @@ GEM
rspec-support (3.12.1)
rspec_junit_formatter (0.6.0)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (1.54.2)
rubocop (1.57.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.3)
parser (>= 3.2.2.4)
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.28.1, < 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-capybara (2.18.0)
rubocop-capybara (2.19.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.23.1)
rubocop-factory_bot (2.24.0)
rubocop (~> 1.33)
rubocop-performance (1.18.0)
rubocop-performance (1.19.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rspec (2.22.0)
rubocop (~> 1.33)
rubocop-rspec (2.25.0)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
rubocop-sorbet (0.7.0)
rubocop-sorbet (0.7.5)
rubocop (>= 0.90.0)
ruby-progressbar (1.13.0)
simplecov (0.22.0)
Expand All @@ -82,13 +82,13 @@ GEM
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
sorbet (0.5.10929)
sorbet-static (= 0.5.10929)
sorbet-runtime (0.5.10929)
sorbet-static (0.5.10929-x86_64-linux)
timecop (0.9.6)
unicode-display_width (2.4.2)
zeitwerk (2.6.8)
sorbet (0.5.11139)
sorbet-static (= 0.5.11139)
sorbet-runtime (0.5.11139)
sorbet-static (0.5.11139-x86_64-linux)
timecop (0.9.8)
unicode-display_width (2.5.0)
zeitwerk (2.6.12)

PLATFORMS
x86_64-linux
Expand All @@ -102,10 +102,10 @@ DEPENDENCIES
reek
rspec (~> 3)
rspec_junit_formatter
rubocop (~> 1.54.2)
rubocop-performance (~> 1.18.0)
rubocop-rspec (~> 2.22.0)
rubocop-sorbet (~> 0.7.0)
rubocop (~> 1.57)
rubocop-performance (~> 1.18)
rubocop-rspec (~> 2.22)
rubocop-sorbet (~> 0.7)
ruby-paseto!
simplecov (~> 0)
simplecov_json_formatter
Expand Down
8 changes: 4 additions & 4 deletions gemfiles/rbnacl.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ gem "rake", "~> 13"
gem "reek"
gem "rspec", "~> 3"
gem "rspec_junit_formatter"
gem "rubocop", "~> 1.54.2"
gem "rubocop-performance", "~> 1.18.0"
gem "rubocop-rspec", "~> 2.22.0"
gem "rubocop-sorbet", "~> 0.7.0"
gem "rubocop", "~> 1.57"
gem "rubocop-performance", "~> 1.18"
gem "rubocop-rspec", "~> 2.22"
gem "rubocop-sorbet", "~> 0.7"
gem "simplecov", "~> 0"
gem "simplecov_json_formatter"
gem "sorbet", "~> 0"
Expand Down
60 changes: 30 additions & 30 deletions gemfiles/rbnacl.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,30 @@ GEM
ast (2.4.2)
diff-lcs (1.5.0)
docile (1.4.0)
ffi (1.15.5)
ffi (1.16.3)
json (2.6.3)
kwalify (0.7.2)
language_server-protocol (3.17.0.3)
multi_json (1.15.0)
oj (3.15.0)
openssl (3.1.0)
oj (3.16.1)
openssl (3.2.0)
parallel (1.23.0)
parallel_tests (4.2.1)
parallel_tests (4.3.0)
parallel
parser (3.2.2.3)
parser (3.2.2.4)
ast (~> 2.4.1)
racc
racc (1.7.1)
racc (1.7.3)
rainbow (3.1.1)
rake (13.0.6)
rake (13.1.0)
rbnacl (7.1.1)
ffi
reek (6.1.4)
kwalify (~> 0.7.0)
parser (~> 3.2.0)
rainbow (>= 2.0, < 4.0)
regexp_parser (2.8.1)
rexml (3.2.5)
regexp_parser (2.8.2)
rexml (3.2.6)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
Expand All @@ -52,31 +52,31 @@ GEM
rspec-support (3.12.1)
rspec_junit_formatter (0.6.0)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (1.54.2)
rubocop (1.57.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.3)
parser (>= 3.2.2.4)
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.28.1, < 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-capybara (2.18.0)
rubocop-capybara (2.19.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.23.1)
rubocop-factory_bot (2.24.0)
rubocop (~> 1.33)
rubocop-performance (1.18.0)
rubocop-performance (1.19.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rspec (2.22.0)
rubocop (~> 1.33)
rubocop-rspec (2.25.0)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
rubocop-sorbet (0.7.0)
rubocop-sorbet (0.7.5)
rubocop (>= 0.90.0)
ruby-progressbar (1.13.0)
simplecov (0.22.0)
Expand All @@ -85,13 +85,13 @@ GEM
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
sorbet (0.5.10929)
sorbet-static (= 0.5.10929)
sorbet-runtime (0.5.10929)
sorbet-static (0.5.10929-x86_64-linux)
timecop (0.9.6)
unicode-display_width (2.4.2)
zeitwerk (2.6.8)
sorbet (0.5.11139)
sorbet-static (= 0.5.11139)
sorbet-runtime (0.5.11139)
sorbet-static (0.5.11139-x86_64-linux)
timecop (0.9.8)
unicode-display_width (2.5.0)
zeitwerk (2.6.12)

PLATFORMS
x86_64-linux
Expand All @@ -105,10 +105,10 @@ DEPENDENCIES
reek
rspec (~> 3)
rspec_junit_formatter
rubocop (~> 1.54.2)
rubocop-performance (~> 1.18.0)
rubocop-rspec (~> 2.22.0)
rubocop-sorbet (~> 0.7.0)
rubocop (~> 1.57)
rubocop-performance (~> 1.18)
rubocop-rspec (~> 2.22)
rubocop-sorbet (~> 0.7)
ruby-paseto!
simplecov (~> 0)
simplecov_json_formatter
Expand Down
8 changes: 4 additions & 4 deletions gemfiles/standalone.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ gem "rake", "~> 13"
gem "reek"
gem "rspec", "~> 3"
gem "rspec_junit_formatter"
gem "rubocop", "~> 1.54.2"
gem "rubocop-performance", "~> 1.18.0"
gem "rubocop-rspec", "~> 2.22.0"
gem "rubocop-sorbet", "~> 0.7.0"
gem "rubocop", "~> 1.57"
gem "rubocop-performance", "~> 1.18"
gem "rubocop-rspec", "~> 2.22"
gem "rubocop-sorbet", "~> 0.7"
gem "simplecov", "~> 0"
gem "simplecov_json_formatter"
gem "sorbet", "~> 0"
Expand Down
Loading

0 comments on commit 2602c22

Please sign in to comment.