Skip to content

Commit cb184f4

Browse files
committed
sorbet: Tapioca can generate RBIs for RuboCop's CopHelper module
- `CopHelper` is a RuboCop module, so include it in the generated RuboCop RBI rather than hand-writing it.
1 parent 643678e commit cb184f4

4 files changed

Lines changed: 21 additions & 18 deletions

File tree

Library/Homebrew/dev-cmd/typecheck.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ def trim_rubocop_rbi(path: HOMEBREW_LIBRARY_PATH/"sorbet/rbi/gems/rubocop@*.rbi"
152152
return unless parsed.success?
153153

154154
allowlist = %w[
155+
CopHelper
155156
Parser::Source
156157
RuboCop::AST::Node
157158
RuboCop::AST::NodePattern

Library/Homebrew/sorbet/rbi/gems/rubocop@1.86.2.rbi

Lines changed: 19 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Library/Homebrew/sorbet/rbi/shims/rspec.rbi

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,3 @@ module RSpec::Mocks::ExampleMethods::ExpectHost
2222
sig { params(value: T.untyped, block: T.nilable(T.proc.void)).returns(T.untyped) }
2323
def expect(value = T.unsafe(nil), &block); end
2424
end
25-
26-
# RuboCop cop specs include this helper at runtime via `rubocop/rspec/support`.
27-
module CopHelper
28-
sig { params(source: String, file: T.untyped).returns(T::Array[T.untyped]) }
29-
def inspect_source(source, file = T.unsafe(nil)); end
30-
31-
sig { params(source: String, file: T.untyped).returns(String) }
32-
def autocorrect_source(source, file = T.unsafe(nil)); end
33-
34-
sig { params(source: String).returns(String) }
35-
def autocorrect_source_file(source); end
36-
37-
sig { params(source: String, file: T.untyped).returns(T.untyped) }
38-
def parse_source(source, file = T.unsafe(nil)); end
39-
end

Library/Homebrew/sorbet/tapioca/require.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
additional_requires_map = {
1010
"parser" => ["parser/current"],
11-
"rubocop-rspec" => ["rubocop/rspec/expect_offense"],
11+
"rubocop-rspec" => ["rubocop/rspec/expect_offense", "rubocop/rspec/cop_helper"],
1212
}.freeze
1313

1414
# Freeze lockfile

0 commit comments

Comments
 (0)