Skip to content

Commit e16159f

Browse files
authored
Start to run steep in CI (line#515)
Using RBS, we were able to detect some minor bugs before release. It also enabled detection of discrepancies between implementation and RBS. We have now reduced errors in strict mode to zero! To automatically catch issues in future changes, let's always verify this. To achieve this, this change adds the job to run steep in CI.
1 parent fb449ba commit e16159f

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

Rakefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ task :rbs do
5555
sh "bundle exec rbs -I sig validate"
5656
end
5757

58+
desc "RBS type check (with steep)"
59+
task :rbs_steep do
60+
sh "bundle exec steep check"
61+
end
62+
5863
desc "RBS type check (with test)"
5964
task :rbs_test do
6065
Dir['lib/line/bot/v2/**/*.rb'].sort.each do |file|
@@ -110,6 +115,7 @@ task :ci do
110115
Rake::Task[:rubocop].invoke
111116
Rake::Task[:validate_yard_comment].invoke
112117
Rake::Task[:rbs].invoke
118+
Rake::Task[:rbs_steep].invoke
113119
Rake::Task[:rbs_test].invoke
114120
Rake::Task[:build_test].invoke
115121
end

Steepfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ target :lib do
99

1010
library "net-http"
1111

12-
configure_code_diagnostics(D::Ruby.default)
13-
# configure_code_diagnostics(D::Ruby.strict) # TODO: Enable strict checking
12+
configure_code_diagnostics(D::Ruby.strict)
1413
# configure_code_diagnostics(D::Ruby.all_error) # TODO: Enable all error checking
1514
end
1615

lib/line/bot/v2/utils.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ def self.deep_camelize(object)
5757
object.map { |item| deep_camelize(item) }
5858
when Hash
5959
object.each_with_object({}) do |(k, v), new_object| # steep:ignore UnannotatedEmptyCollection
60-
camel_key = camelize(k).to_sym
60+
camel_key = camelize(k)
61+
next if camel_key.nil?
62+
63+
camel_key = camel_key.to_sym
6164
new_value = v.is_a?(Array) || v.is_a?(Hash) ? deep_camelize(v) : v
6265
new_object[camel_key] = new_value
6366
end

0 commit comments

Comments
 (0)