Convert YARD docs to Sorbet RBI and Ruby 3/Steep RBS files

Sord is a Sorbet and YARD crossover. It can automatically generate RBI and RBS type signature files by looking at the types specified in YARD documentation comments.If your project is already YARD documented, then this can generate most of the type signatures you need!Sord is the perfect way to jump-start the adoption of types in your project, whether you plan to use Sorbet's RBI format or Ruby 3/Steep's RBS format.Sord has the following features:Automatically generates signatures for modules, classes and methodsSupport for multiple parameter or return types (T.any/|)Gracefully handles missing YARD types (T.untyped/untyped)Can infer setter parameter type from the corresponding getter's return typeRecognises mixins (include and extend)Support for generic types such as Array and HashCan infer namespaced classes ([Bar] can become GemName::Foo::Bar)Handles return types which can be nil (T.nilable/untyped)Handles duck types (T.untyped/untyped)Support for ordered list types ([Array(Integer, Symbol)] becomes [Integer, Symbol])Support for boolean types ([true, false] becomes T::Boolean/bool)Support for .
Convert YARD docs to Sorbet RBI and Ruby 3/Steep RBS files #ruby #rails #rubyonrails #bosnia #programming #tutorials #rubydeveloper #railsdeveloper

Nezir Zahirovic

Freelance software developer Ruby On Rails (6 years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles