rails-tc

This gem provides time checking for Rails projects using Stripe's sorbet and tapioca. It is meant to provide an easy and automated way to set up time checking.

Installing

Add the gem to your Gemfile by adding the line

gem 'rails-tc', group: :development

and run bundle install

or do both actions at once by running

bundle add rails-tc --group development

Usage

Setup typing for the project

Once installed, run the following command once:

rails tc:install

This will:

  • Add sorbet and tapioca as development dependencies
  • Add sorbet-runtime as runtime dependency
  • Initialize and setup sorbet
  • Generate types for the current project using tapioco
  • Patch rubocop config to disable Style/AccessorGrouping

Run the type checker

To check the project for type errors, run

rails tc:check

This will list all errors but excludes all errors from *.rbi files because there will be a lot of false positives and from gems and known issues we cannot change anyway.

Update rails-specific type information

To update type information for url helpers and models, run:

rails tc:generate