Closed JamieMagee closed 10 months ago
🤔 How would we determine which file to check?
Anything with a valid sigil? Here's a grep command that I've been using to achieve the same thing
grep --files-without-match "require \"sorbet-runtime\"" $(grep --files-with-matches "# typed: " --include "*.rb" --recursive)
But it doesn't need to be added in every file with a sigil. In a gem you'd typically have it in the gem's entry point file:
https://github.com/Shopify/tapioca/blob/01d7796c7d1d819fc3f03ef655e0cdef1aa6c44e/lib/tapioca.rb#L4
and in a Rails app you'd usually have it in boot.rb
.
Interesting, the Sorbet docs don't mention this. Is this still true if you're gradually typing a codebase and want to partially opt-in to runtime checks?
Yes, e.g. with # typed: false
.
I agree the Sorbet docs could be better for this.
Closing since there doesn't seem to be a valid case for this.
This would be something like
Sorbet/EnforceRuntimeChecks
and would ensure static and runtime checks are enabled.