Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI

on:
push:
branches:
- main
pull_request:

jobs:
ci:
runs-on: ubuntu-latest
name: CI checks
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Ruby
uses: ruby/setup-ruby@09a7688d3b55cf0e976497ff046b70949eeaccfd # v1.288.0
with:
bundler-cache: true
rubygems: 4.0.4
- name: Run type check
run: bundle exec rake typecheck
- name: Run type check with Prism parser
run: bundle exec rake typecheck_prism
continue-on-error: true
- name: Run tests
run: bundle exec rake test
continue-on-error: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want this to continue?

- name: Lint Ruby files
run: bundle exec rake rubocop
- name: Verify gem RBIs are up-to-date
run: bin/tapioca gem --verify
- name: Verify duplicates in shims
run: bin/tapioca check-shims
15 changes: 10 additions & 5 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
inherit_gem:
rubocop-shopify: rubocop.yml

plugins:
- rubocop-minitest
- rubocop-rake

AllCops:
TargetRubyVersion: 3.2
NewCops: enable

Style/StringLiterals:
EnforcedStyle: double_quotes

Style/StringLiteralsInInterpolation:
EnforcedStyle: double_quotes
Style/Semicolon:
AllowAsExpressionSeparator: true
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ gemspec
gem "irb"
gem "rake", "~> 13.0"

gem "sorbet"
gem "tapioca", ">= 0.17", require: false
gem "minitest", "~> 5.16"

gem "rubocop", "~> 1.21"
gem "rubocop-shopify", require: false
gem "rubocop-minitest", require: false
gem "rubocop-rake", require: false
83 changes: 82 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ GEM
remote: https://rubygems.org/
specs:
ast (2.4.3)
benchmark (0.5.0)
date (3.5.1)
erb (6.0.1)
erubi (1.13.1)
io-console (0.8.2)
irb (1.17.0)
pp (>= 0.6.0)
Expand All @@ -18,7 +20,9 @@ GEM
json (2.18.1)
language_server-protocol (3.17.0.5)
lint_roller (1.1.0)
logger (1.7.0)
minitest (5.27.0)
netrc (0.11.0)
parallel (1.27.0)
parser (3.3.10.2)
ast (~> 2.4.1)
Expand All @@ -33,13 +37,22 @@ GEM
racc (1.8.1)
rainbow (3.1.1)
rake (13.3.1)
rbi (0.3.9)
prism (~> 1.0)
rbs (>= 3.4.4)
rbs (4.0.0.dev.5)
logger
prism (>= 1.3.0)
tsort
rdoc (7.2.0)
erb
psych (>= 4.0.0)
tsort
regexp_parser (2.11.3)
reline (0.6.3)
io-console (~> 0.5)
require-hooks (0.2.2)
rexml (3.4.4)
rubocop (1.84.2)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
Expand All @@ -54,34 +67,85 @@ GEM
rubocop-ast (1.49.0)
parser (>= 3.3.7.2)
prism (~> 1.7)
rubocop-minitest (0.38.2)
lint_roller (~> 1.1)
rubocop (>= 1.75.0, < 2.0)
rubocop-ast (>= 1.38.0, < 2.0)
rubocop-rake (0.7.1)
lint_roller (~> 1.1)
rubocop (>= 1.72.1)
rubocop-shopify (2.18.0)
rubocop (~> 1.62)
ruby-progressbar (1.13.0)
sorbet (0.6.12945)
sorbet-static (= 0.6.12945)
sorbet-runtime (0.6.12945)
sorbet-static (0.6.12945-universal-darwin)
sorbet-static (0.6.12945-x86_64-linux)
sorbet-static-and-runtime (0.6.12945)
sorbet (= 0.6.12945)
sorbet-runtime (= 0.6.12945)
spoom (1.7.11)
erubi (>= 1.10.0)
prism (>= 0.28.0)
rbi (>= 0.3.3)
rbs (>= 4.0.0.dev.4)
rexml (>= 3.2.6)
sorbet-static-and-runtime (>= 0.5.10187)
thor (>= 0.19.2)
stringio (3.2.0)
tapioca (0.17.10)
benchmark
bundler (>= 2.2.25)
netrc (>= 0.11.0)
parallel (>= 1.21.0)
rbi (>= 0.3.7)
require-hooks (>= 0.2.2)
sorbet-static-and-runtime (>= 0.5.11087)
spoom (>= 1.7.9)
thor (>= 1.2.0)
yard-sorbet
thor (1.5.0)
tsort (0.2.0)
unicode-display_width (3.2.0)
unicode-emoji (~> 4.1)
unicode-emoji (4.2.0)
yard (0.9.38)
yard-sorbet (0.9.0)
sorbet-runtime
yard

PLATFORMS
arm64-darwin-23
arm64-darwin-24
ruby
x86_64-linux

DEPENDENCIES
irb
minitest (~> 5.16)
rake (~> 13.0)
rubocop (~> 1.21)
rubocop-minitest
rubocop-rake
rubocop-shopify
sorbet
tapioca (>= 0.17)
type_toolkit!

CHECKSUMS
ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
benchmark (0.5.0) sha256=465df122341aedcb81a2a24b4d3bd19b6c67c1530713fd533f3ff034e419236c
date (3.5.1) sha256=750d06384d7b9c15d562c76291407d89e368dda4d4fff957eb94962d325a0dc0
erb (6.0.1) sha256=28ecdd99c5472aebd5674d6061e3c6b0a45c049578b071e5a52c2a7f13c197e5
erubi (1.13.1) sha256=a082103b0885dbc5ecf1172fede897f9ebdb745a4b97a5e8dc63953db1ee4ad9
io-console (0.8.2) sha256=d6e3ae7a7cc7574f4b8893b4fca2162e57a825b223a177b7afa236c5ef9814cc
irb (1.17.0) sha256=168c4ddb93d8a361a045c41d92b2952c7a118fa73f23fe14e55609eb7a863aae
json (2.18.1) sha256=fe112755501b8d0466b5ada6cf50c8c3f41e897fa128ac5d263ec09eedc9f986
language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc
lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
minitest (5.27.0) sha256=2d3b17f8a36fe7801c1adcffdbc38233b938eb0b4966e97a6739055a45fa77d5
netrc (0.11.0) sha256=de1ce33da8c99ab1d97871726cba75151113f117146becbe45aa85cb3dabee3f
parallel (1.27.0) sha256=4ac151e1806b755fb4e2dc2332cbf0e54f2e24ba821ff2d3dcf86bf6dc4ae130
parser (3.3.10.2) sha256=6f60c84aa4bdcedb6d1a2434b738fe8a8136807b6adc8f7f53b97da9bc4e9357
pp (0.6.3) sha256=2951d514450b93ccfeb1df7d021cae0da16e0a7f95ee1e2273719669d0ab9df6
Expand All @@ -91,17 +155,34 @@ CHECKSUMS
racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
rake (13.3.1) sha256=8c9e89d09f66a26a01264e7e3480ec0607f0c497a861ef16063604b1b08eb19c
rbi (0.3.9) sha256=d6a187bd0b376e999d3d82a5e5798a61178be98b894b7b35741c14162c9ea015
rbs (4.0.0.dev.5) sha256=273938e5a9c7f06b041be583588f2aa1976149bda2ce213e33e129c51534e174
rdoc (7.2.0) sha256=8650f76cd4009c3b54955eb5d7e3a075c60a57276766ebf36f9085e8c9f23192
regexp_parser (2.11.3) sha256=ca13f381a173b7a93450e53459075c9b76a10433caadcb2f1180f2c741fc55a4
reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835
require-hooks (0.2.2) sha256=effa81b61a669ca00cb1e8910411e0d6a8bb16b49a53d9e69b5e6372d6c90f31
rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142
rubocop (1.84.2) sha256=5692cea54168f3dc8cb79a6fe95c5424b7ea893c707ad7a4307b0585e88dbf5f
rubocop-ast (1.49.0) sha256=49c3676d3123a0923d333e20c6c2dbaaae2d2287b475273fddee0c61da9f71fd
rubocop-minitest (0.38.2) sha256=5a9dfb5a538973d0601aa51e59637d3998bb8df81233edf1ff421504c6280068
rubocop-rake (0.7.1) sha256=3797f2b6810c3e9df7376c26d5f44f3475eda59eb1adc38e6f62ecf027cbae4d
rubocop-shopify (2.18.0) sha256=dafa25e5617ce4600ff86b1de3d5b78e43ab3d58cc5729df38e492b8e10294eb
ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
sorbet (0.6.12945) sha256=40fd8c121f7e9ded24462daf757707dc588889646daed478a47b7359d2969d84
sorbet-runtime (0.6.12945) sha256=3ddd992650437557fb87deb13c94d7250aeeab326812e7a863dfd4955f0758f3
sorbet-static (0.6.12945-universal-darwin) sha256=766038d71e0ab7f8a60eb298b742d4e5fb9bd364034c651443f825fb4d61f11e
sorbet-static (0.6.12945-x86_64-linux) sha256=c393afe666e41d51afa111b6913b572aee6032f3a77546ea5fb1b690906fcc25
sorbet-static-and-runtime (0.6.12945) sha256=6a0ae4ac59ddc874e9438ff6e0f23b4eb78569c6d412ced4e043f3a6db6b44d0
spoom (1.7.11) sha256=4e27384af6d3fde5aadc0287c51e6f76c0802259cbb3b6a67603bf718352f4cf
stringio (3.2.0) sha256=c37cb2e58b4ffbd33fe5cd948c05934af997b36e0b6ca6fdf43afa234cf222e1
tapioca (0.17.10) sha256=880a682ca8314f798dd09e9f104134fbf1a713c13be51f7dd4741dd434e6471b
thor (1.5.0) sha256=e3a9e55fe857e44859ce104a84675ab6e8cd59c650a49106a05f55f136425e73
tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f
type_toolkit (0.0.2)
unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f
yard (0.9.38) sha256=721fb82afb10532aa49860655f6cc2eaa7130889df291b052e1e6b268283010f
yard-sorbet (0.9.0) sha256=03d1aa461b9e9c82b886919a13aa3e09fcf4d1852239d2967ed97e92723ffe21

BUNDLED WITH
4.0.3
28 changes: 26 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,36 @@
# frozen_string_literal: true

require "bundler/gem_tasks"

desc "Type-check the code base with Sorbet"
task :typecheck do
sh "bundle exec srb tc" do |ok, _res|
abort unless ok
end
end

# Aliases for common names for this task.
desc "alias for typecheck"; task tc: :typecheck
desc "alias for typecheck"; task srb: :typecheck
desc "alias for typecheck"; task sorbet: :typecheck

desc "Type-check the code base with Sorbet using Prism"
task :typecheck_prism do
sh "bundle exec srb tc --parser=prism" do |ok, _res|
abort unless ok
end
end

require "minitest/test_task"

Minitest::TestTask.create
Minitest::TestTask.create do |t|
t.libs.delete("test")
t.libs << "spec"
t.test_globs = ["spec/**/*_spec.rb"]
end

require "rubocop/rake_task"

RuboCop::RakeTask.new

task default: %i[test rubocop]
task default: [:typecheck, :test, :rubocop]
16 changes: 16 additions & 0 deletions bin/tapioca
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/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__)

require "rubygems"
require "bundler/setup"

load Gem.bin_path("tapioca", "tapioca")
3 changes: 1 addition & 2 deletions lib/type_toolkit.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# typed: strong
# frozen_string_literal: true

require_relative "type_toolkit/version"

module TypeToolkit
class Error < StandardError; end
# Your code goes here...
end
1 change: 1 addition & 0 deletions lib/type_toolkit/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: strong
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We advise against using strong, let's lead by example and use strict

# frozen_string_literal: true

module TypeToolkit
Expand Down
6 changes: 6 additions & 0 deletions sorbet/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
--dir
.
--ignore=tmp/
--ignore=vendor/
--enable-experimental-rbs-comments
--suppress-payload-superclass-redefinition-for=RDoc::Markup::Heading
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird EOF, was this generated by Tapioca? We may need to fix something.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I think it was manual

1 change: 1 addition & 0 deletions sorbet/rbi/annotations/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/*.rbi linguist-vendored=true
Loading
Loading