Question regarding sorbet setup: How to unsilence the errors in step 4

Viewed 95

In the documentation here https://sorbet.org/docs/adopting#step-4-fix-constant-resolution-errors it states:

At this point, it’s likely that there are lots of errors in our project, but Sorbet silences them by default. Our next job is to unsilence them and then fix the root causes. Empirically, there are a handful of categories of errors people encounter at this step:

But does not say how to unsilence the errors

I have looked through the documentation, and the issues and previous tagged questions here. Have also tried the srb tc -h and srb rbi -h commands but have found nothing so far - is this just regarding swapping typed: false to one of the other settings?

2 Answers

The answer is here: https://sorbet.org/docs/static

However, in step (3), most kinds of errors are silenced by default, instead of being reported. To opt into more checks, we use # typed: sigils.

So yes, just use a stronger strictness level, like true.

It mostly involves changing “typed: ignore” and “typed: false” to something stronger.

If you find and fix a class of problem though, you can use sorbet to upgrade the type-check level every files in the repo

$ srb tc --suggest-typed --typed=strict --error-white-list=7022 --autocorrect
Related