Programming Ruby 3.2 (5th Edition): Using Sorbet (p. 312)

“Alternately you can list one or more specific paths (.rb or .rbi files after the tc) to limit checking,”

It might be worth mentioning that the default sorbet/config file generated with Sorbet includes --dir=.

If the user passes specific paths on the command line, those are added to the --dir=. option, so that what will be typechecked is all of . and the provided paths.

Usually, unless a single file does not have any dependencies outside of the standard library, it’s not a good idea to try to typecheck a single file in isolation.

If you really want to do it, you can either pass --no-config, change the sorbet/config file, or cd to a different directory.