Skip to content

Commit f98fe6b

Browse files
committed
Add steep infrastructure for testing type signatures
- added steep and rbs to gemspec - added type signature tests to github actions - updated Steepfile
1 parent 4a17be4 commit f98fe6b

File tree

4 files changed

+30
-20
lines changed

4 files changed

+30
-20
lines changed

.github/workflows/pull_request.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ jobs:
1818
bundler-cache: true
1919
- name: Run RuboCop
2020
run: bundle exec rubocop
21+
- name: Run Steep / RBS Type signature verification
22+
run: |
23+
steep check --steepfile=./Steepfile --severity-level=error | ruby -pe 'sub(/^(.+):(\d+):(\d+): (.+)$/, %q{::error file=\1,line=\2,col=\3::\4})'
24+
shell: bash
2125

2226
test:
2327
runs-on: ${{ matrix.os }}-latest

Steepfile

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,31 @@
1-
# D = Steep::Diagnostic
2-
#
1+
D = Steep::Diagnostic
2+
33
target :lib do
4-
signature "sig"
4+
signature "*.rbs"
5+
6+
check "lib/unleash/client.rb"
7+
check "lib/unleash/context.rb"
8+
check "lib/unleash/scheduled_executor.rb"
59

6-
# check "lib/unleash/client.rbs" # Directory name
7-
check "lib" # Directory name
8-
# check "Gemfile" # File name
9-
# check "app/models/**/*.rb" # Glob
10-
# ignore "lib/templates/*.rb"
10+
ignore "lib/unleash/bootstrap"
11+
ignore "lib/unleash/strategy/*.rb"
12+
ignore "lib/unleash/util"
13+
14+
ignore "lib/unleash/constraint.rb"
15+
ignore "lib/unleash/feature_toggle.rb"
16+
ignore "lib/unleash/metrics.rb"
17+
ignore "lib/unleash/metrics_reporter.rb"
18+
ignore "lib/unleash/toggle_fetcher.rb"
19+
ignore "lib/unleash/variant_definition.rb"
20+
ignore "lib/unleash/variant_override.rb"
1121

1222
# library "pathname", "set" # Standard libraries
1323
# library "strong_json" # Gems
1424

1525
# configure_code_diagnostics(D::Ruby.strict) # `strict` diagnostics setting
1626
# configure_code_diagnostics(D::Ruby.lenient) # `lenient` diagnostics setting
17-
# configure_code_diagnostics do |hash| # You can setup everything yourself
18-
# hash[D::Ruby::NoMethod] = :information
19-
# end
27+
configure_code_diagnostics do |hash| # You can setup everything yourself
28+
hash[D::Ruby::NoMethod] = :information
29+
hash[D::Ruby::UnsupportedSyntax] = :information
30+
end
2031
end
21-
22-
# target :test do
23-
# # signature "sig", "sig-private"
24-
# #
25-
# check "spec"
26-
# #
27-
# # # library "pathname", "set" # Standard libraries
28-
# end

lib/unleash/client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def register
162162
end
163163

164164
def disabled_variant
165-
@disabled_variant ||= Unleash::FeatureToggle.disabled_variant
165+
Unleash::FeatureToggle.disabled_variant
166166
end
167167

168168
def first_fetch_is_eager

unleash-client.gemspec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,7 @@ Gem::Specification.new do |spec|
3939

4040
spec.add_development_dependency "simplecov", "~> 0.21.2"
4141
spec.add_development_dependency "simplecov-lcov", "~> 0.8.0"
42+
43+
spec.add_development_dependency "rbs", "~> 2.7"
44+
spec.add_development_dependency "steep", "~> 1.2"
4245
end

0 commit comments

Comments
 (0)