`tapioca gem` misses sig for module_function methods of the class variety
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
Research direction
Reproduce the generated sorbet/rbi/gems/code_ownership@1.37.0.rbi output with tapioca gem code_ownership, using the code_ownership.rb module_function example. Trace Tapioca's gem RBI generation and compare it with the rbi gem's parsing behavior; done means the generated RBI retains the signature for both the instance and singleton method, or uses module_function as shown.
Written by the indexing model from the issue text.
Description
When generating sorbet/rbi/gems/code_ownership@1.37.0.rbi with tapioca gem code_ownership module_function defined methods will be created without signatures.
# Gemfile
source "https://rubygems.org"
gem 'tapioca', require: false, :group => [:development, :test]
gem "code_ownership", "1.37.0"
Specifically
# code_ownership.rb
module CodeOwnership
module_function
sig { params(klass: T.nilable(T.any(::Module, T::Class[T.anything]))).returns(T.nilable(::CodeTeams::Team)) }
def for_class(klass); end
end
will be turned into
# code_ownership.rbi
module CodeOwnership
sig { params(klass: T.nilable(T.any(::Module, T::Class[T.anything]))).returns(T.nilable(::CodeTeams::Team)) }; def for_class(klass); end
class << self
def for_class(klass); end
end
end
should be turned into
# code_ownership.rbi
module CodeOwnership
sig { params(klass: T.nilable(T.any(::Module, T::Class[T.anything]))).returns(T.nilable(::CodeTeams::Team)); def for_class(klass); end
class << self
sig { params(klass: T.nilable(T.any(::Module, T::Class[T.anything]))).returns(T.nilable(::CodeTeams::Team)) }; def for_class(klass); end
end
end
OR
# code_ownership.rbi
module CodeOwnership
module_function
sig { params(klass: T.nilable(T.any(::Module, T::Class[T.anything]))).returns(T.nilable(::CodeTeams::Team)) }; def for_class(klass); end
end
I tried testing this in the rbi gem but it correctly parsed the module to the last one above
I'll gladly dive into the code to fix this if somebody could point out where this is an issue. I did some code diving as you can see already but I'm a bit lost where
- Dominant language
- Ruby
- Stars
- 873
- Forks
- 164
- Avg merge
- 4d 27m
- Merged PRs (30d)
- 9
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Shopify/tapioca
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
bug
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 58/100
Similar issues
-
user-reported
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Kong/developer.konghq.com#7316 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
TheOdinProject/curriculum#31408 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
notch8/utk_knapsack#148 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
Homebrew/homebrew-cask#288729 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100