rigor-rbs-inline
Ingests rbs-inline-shaped
comments (# @rbs name: T, #: () -> T, # @rbs return: T, attribute
#: casts, # @rbs! raw RBS, …) in your Ruby source and feeds the
synthesised RBS into the analysis environment — so a # @rbs
annotation Rigor would otherwise ignore becomes an enforced contract
that fires the same argument-type-mismatch diagnostics as a
hand-written .rbs file. The design is recorded in
ADR-32.
It ships bundled in rigortype. Activate it under plugins::
plugins: - rigor-rbs-inlineFull guide. The worked walkthrough — every supported annotation form, the magic-comment opt-in, the top-level-
defcaveat, and parse- failure handling — is handbook chapter 7 — RBS and Extended, § “Inline RBS in Ruby source”. This page is the operational quick reference.
What it does
Section titled “What it does”Per file, opt in with the upstream magic comment:
# rbs_inline: enabled
class AscDesc # @rbs asc_or_desc: :asc | :desc def ascdesc(asc_or_desc) = asc_or_descend
AscDesc.new.ascdesc(:bad) # error: argument type mismatch — expected :asc | :desc, got :badFiles without # rbs_inline: enabled are untouched (a top-of-file scan
only). The synthesised RBS is cached per file (keyed on content SHA +
plugin id/version + config), so an unchanged second run skips the parse.
| Rule | Severity | Fires when |
|---|---|---|
plugin.rbs-inline.source-rbs-synthesis-failed | info | rbs-inline could not parse a file; analysis falls back to no inline-RBS contribution and the diagnostic carries the upstream error |
Configuration
Section titled “Configuration”plugins: - gem: rigor-rbs-inline config: require_magic_comment: true # defaultrequire_magic_comment(defaulttrue) — whentrue, only files carrying# rbs_inline: enabledare processed. Setfalseto treat every file as if it carried the magic comment — useful only when you own the whole analysis scope (a single-file CI run or the hosted browser playground, which sets it so pasted snippets analyse without the magic line).
Limitations
Section titled “Limitations”- Top-level
defproduces no RBS. Upstream rbs-inline emits nothing for a bare top-leveldef(verified against rbs-inline 0.14.0) — wrap the method in aclass/module. This is an inherited upstream behaviour, not a Rigor limitation. - Parse failures fail soft. A file rbs-inline can’t parse is
analysed as if it had no inline RBS (the
:infodiagnostic above records it); re-stamp the severity viaseverity_profile:to escalate. - Runtime dependency. The plugin pulls in the
rbs-inlinegem; corerigortypestays zero-runtime-dep, so only projects that opt in pay it.
Plugin internals
Section titled “Plugin internals”The synthesizer, the source_rbs_synthesizer: manifest hook, and the
caching wiring are in the
plugin’s README. To write
a plugin, see examples/ and the
rigor-plugin-author skill.
© 2026 TypedDuck. Licensed under CC BY-SA 4.0.