Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mixes_in_class_methods support #77

Merged
merged 1 commit into from Oct 12, 2021
Merged

Add mixes_in_class_methods support #77

merged 1 commit into from Oct 12, 2021

Conversation

dduugg
Copy link
Owner

@dduugg dduugg commented Oct 6, 2021

Adds support for mixes_in_class_methods, extending the class methods namespace when the surrounding module is included.

# https://github.com/sorbet/sorbet-typed/edit/master/lib/yard/all/yard.rbi
#
# typed: strict
# typed: true
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This blocks on sorbet/sorbet-typed#374
I've included that change here, but i'll update this file in a separate commit once that PR is accepted.

end

class A # error: Missing definition for abstract method
include M
Copy link
Owner Author

@dduugg dduugg Oct 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example is lifted from https://sorbet.org/docs/abstract#interfaces-and-the-included-hook

One can also invoke yard doc on this test file to very that that A is documented as extending M::ClassMethods:

image

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hang on, this has a 🐛 : The documentation for A should indicate that it includes M.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(False alarm, that's due to the IgnoreMonkeyPatchMixins handler i use to avoid warnings when self-documenting)

@codecov
Copy link

codecov bot commented Oct 6, 2021

Codecov Report

Merging #77 (40a4d82) into main (3fe73b6) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              main       #77   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           18        21    +3     
  Lines          691       739   +48     
=========================================
+ Hits           691       739   +48     
Impacted Files Coverage Δ
lib/yard-sorbet/handlers.rb 100.00% <100.00%> (ø)
lib/yard-sorbet/handlers/include_handler.rb 100.00% <100.00%> (ø)
...-sorbet/handlers/mixes_in_class_methods_handler.rb 100.00% <100.00%> (ø)
spec/yard_sorbet/handlers/include_handler_spec.rb 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3fe73b6...40a4d82. Read the comment docs.

Copy link
Contributor

@KaanOzkan KaanOzkan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing. Proxy objects are new to me but overall logic and tests makes sense 👍

@dduugg dduugg merged commit f0d3c5d into main Oct 12, 2021
@dduugg dduugg deleted the mixin-handler branch August 8, 2022 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants