Sorbet, a static type checking system for Ruby, open source

Stripe, a company specializing in the development of platforms for online payments, opened project source code Sorbet Ice Cream, within which a static type checking system for the Ruby language was prepared. The code is written in C++ and spreads licensed under Apache 2.0.

Type information in code can be calculated dynamically, as well as given in the form of simple annotations, which can be specified in code using the sig method (for example, "sig {params(x: Integer).returns(String)}") or placed in separate files with the rbi extension. Available as preliminary static code analysis without its execution, and checking as it is done (turns on by adding "require 'sorbet-runtime'" to the code).

Possibility provided gradual transfer projects to use Sorbet - the code can combine both annotated typed blocks and untyped sections not covered by the check. Of the features, it also notes very high performance and scalability for codebases that include millions of lines of code.

The project includes a kernel for static type checking,
a toolkit for creating new projects using Sorbet, a toolkit for step-by-step transition of existing projects to Sorbet, a runtime with a domain-specific language for writing annotations about types and repository with ready-made type definitions for various Ruby gems.

Initially, Sorbet was developed to test the internal projects of the Stripe company, most of the payment and analytical systems in which are written in Ruby, and was transferred to the open category after a year and a half of development and implementation. Before opening the code, beta testing was conducted, in which more than 30 companies took part. At the current stage of development, Sorbet supports the launch of most typical Ruby projects, but there may be some incompatibilities.

Source: opennet.ru

Add a comment