-
Notifications
You must be signed in to change notification settings - Fork 10
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
Experimental: Publish RBI signatures to enable type-checked TDD #22
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yields: The sorbet/ folder should exist and look something like this: ├── config # Default options to be passed to Sorbet on every run └── rbi/ ├── annotations/ # Type definitions pulled from the rbi-central repository ├── gems/ # Autogenerated type definitions for your gems └── todo.rbi # Constants which were still missing after RBI generation └── tapioca/ ├── config.yml # Default options to be passed to Tapioca └── require.rb # A file where you can make requires from gems that might be needed for gem RBI generation Please check this folder into version control. 🤔 What's next 1. Many Ruby applications use metaprogramming DSLs to dynamically generate constants and methods. To generate type definitions for any DSLs in your application, run: bin/tapioca dsl 2. Check whether the constants in the sorbet/rbi/todo.rbi file actually exist in your project. It is possible that some of these constants are typos, and leaving them in todo.rbi will hide errors in your application. Ideally, you should be able to remove all definitions from this file and delete it. 3. Typecheck your project: bundle exec srb tc There should not be any typechecking errors. 4. Upgrade a file marked "# typed: false" to "# typed: true". Then, run: bundle exec srb tc and try to fix any errors. You can use Spoom to bump files for you: spoom bump --from false --to true To learn more about Spoom, visit: https://github.com/Shopify/spoom 5. Add signatures to your methods with sig. To learn how, read: https://sorbet.org/docs/sigs Documentation We recommend skimming these docs to get a feel for how to use Sorbet: - Gradual Type Checking: https://sorbet.org/docs/gradual - Enabling Static Checks: https://sorbet.org/docs/static
…to test-drive a rbi/mocktail.rbi file
… and we'll type-check it void
…e via tests that something fails a type check
… if I define the method signature exactly how it generates it by default? It fails silently when it doesn't incorporate a signature, which is unhelpful (I thought this was working previously)
This reverts commit bd8aad6.
… avoid feedback loop
…struct Lots of last minute changes… hope it works!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This isn't close to ready yet, but I've made some progress. Will write more here when there's more to say.