Skip to content

Commit 90474c2

Browse files
authored
Add RBS type signatures and Steep configuration (#2)
1 parent 13a617a commit 90474c2

27 files changed

+697
-2
lines changed

.github/workflows/steep.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Steep
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
steep:
13+
name: Type Check
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v6
19+
20+
- name: Set up Ruby
21+
uses: ruby/setup-ruby@v1
22+
with:
23+
ruby-version: "3.4"
24+
25+
- name: Install dependencies
26+
run: bundle install
27+
28+
- name: Cache RBS collection
29+
uses: actions/cache@v4
30+
with:
31+
path: .gem_rbs_collection
32+
key: rbs-collection-${{ hashFiles('rbs_collection.lock.yaml') }}
33+
restore-keys: |
34+
rbs-collection-
35+
36+
- name: Install RBS collection
37+
run: bundle exec rbs collection install
38+
39+
- name: Run Steep type check
40+
run: bundle exec steep check

Gemfile.lock

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,23 @@ GEM
3030
bigdecimal (4.0.1)
3131
concurrent-ruby (1.3.6)
3232
connection_pool (3.0.2)
33+
csv (3.3.5)
3334
diff-lcs (1.6.2)
3435
drb (2.2.3)
36+
ffi (1.17.3-arm64-darwin)
37+
fileutils (1.8.0)
3538
i18n (1.14.8)
3639
concurrent-ruby (~> 1.0)
3740
json (2.18.0)
3841
language_server-protocol (3.17.0.5)
3942
lint_roller (1.1.0)
43+
listen (3.9.0)
44+
rb-fsevent (~> 0.10, >= 0.10.3)
45+
rb-inotify (~> 0.9, >= 0.9.10)
4046
logger (1.7.0)
4147
minitest (6.0.1)
4248
prism (~> 1.5)
49+
mutex_m (0.3.0)
4350
parallel (1.27.0)
4451
parser (3.3.10.0)
4552
ast (~> 2.4.1)
@@ -49,6 +56,11 @@ GEM
4956
rack (3.2.4)
5057
rainbow (3.1.1)
5158
rake (13.3.1)
59+
rb-fsevent (0.11.2)
60+
rb-inotify (0.11.1)
61+
ffi (~> 1.0)
62+
rbs (3.10.2)
63+
logger
5264
regexp_parser (2.11.3)
5365
rspec (3.13.2)
5466
rspec-core (~> 3.13.0)
@@ -110,6 +122,26 @@ GEM
110122
rubocop-rake (>= 0.7)
111123
rubocop-rspec (>= 3.5)
112124
rubocop-rspec_rails (>= 2.31)
125+
steep (1.10.0)
126+
activesupport (>= 5.1)
127+
concurrent-ruby (>= 1.1.10)
128+
csv (>= 3.0.9)
129+
fileutils (>= 1.1.0)
130+
json (>= 2.1.0)
131+
language_server-protocol (>= 3.17.0.4, < 4.0)
132+
listen (~> 3.0)
133+
logger (>= 1.3.0)
134+
mutex_m (>= 0.3.0)
135+
parser (>= 3.1)
136+
rainbow (>= 2.2.2, < 4.0)
137+
rbs (~> 3.9)
138+
securerandom (>= 0.1)
139+
strscan (>= 1.0.0)
140+
terminal-table (>= 2, < 5)
141+
uri (>= 0.12.0)
142+
strscan (3.1.7)
143+
terminal-table (4.0.0)
144+
unicode-display_width (>= 1.1.1, < 4)
113145
thor (1.5.0)
114146
tzinfo (2.0.6)
115147
concurrent-ruby (~> 1.0)
@@ -125,8 +157,10 @@ PLATFORMS
125157
DEPENDENCIES
126158
appraisal (>= 2.5)
127159
rake (>= 13.2)
160+
rbs (>= 3.8)
128161
rspec (>= 3.13)
129162
servactory-rubocop (>= 0.9)
163+
steep (>= 1.9)
130164
stroma!
131165

132166
BUNDLED WITH

Steepfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# frozen_string_literal: true
2+
3+
D = Steep::Diagnostic
4+
5+
target :lib do
6+
signature "sig"
7+
signature "sig/external"
8+
9+
check "lib"
10+
11+
# Enable strict mode for better type safety
12+
configure_code_diagnostics(D::Ruby.strict)
13+
14+
# Disable specific diagnostics that don't work well with common Ruby patterns
15+
configure_code_diagnostics do |config|
16+
# Mixin modules calling super in methods that will be available after include
17+
config[D::Ruby::UnexpectedSuper] = :information
18+
19+
# instance_eval block type mismatch (block doesn't use self argument)
20+
config[D::Ruby::BlockTypeMismatch] = :information
21+
end
22+
23+
# Data.define with block causes Steep type checking issues
24+
# See: https://github.com/ruby/rbs/blob/master/docs/data_and_struct.md
25+
ignore "lib/stroma/hooks/hook.rb"
26+
27+
# Complex splat delegation (*args) in fetch method causes type checking issues
28+
ignore "lib/stroma/settings/setting.rb"
29+
end

0 commit comments

Comments
 (0)