Repolode
rigortype

rigortype/rigor

Ruby static analyzer that infers types from code without annotations, aiming to report only conclusive bugs such as undefined methods and nil receivers.

Stars
107
Forks
1
Open issues
538
Last commit
20 hours ago

What is it?

Rigor is a static analysis tool for Ruby that finds bugs such as calls to undefined methods, wrong argument counts, receivers that may be nil on a live path, unreachable branches, and conditions that are always truthy. It parses code with Prism and runs a flow-sensitive inference engine that tracks the values expressions produce, not only their classes. Messages include the computed value, for example reporting an undefined method on the string "hello-world" rather than on String.

No annotations or runtime dependency are required to start. Existing RBS signatures in sig/ are read as a type source, and rigor sig-gen can emit RBS from inference results. The project emphasizes a zero-false-positive policy: diagnostics fire only when the receiver type is statically known and the evidence is conclusive. Plugins are available for Rails, RSpec, Sidekiq, Sinatra, dry-rb and other gems, and rigor-sorbet ingests Sorbet signatures.

The tool is installed globally as the rigortype gem and provides commands for checking, annotating types inline, triaging diagnostics, and generating signatures. CI output formats include GitHub annotations, GitLab Code Quality, SARIF, JUnit and others.

Key features

  • 01Infers value-level types from unannotated Ruby code using flow-sensitive analysis.
  • 02Reports undefined methods, wrong argument counts, and possibly-nil receivers.
  • 03Reads existing RBS signatures and can generate RBS from inference results.
  • 04Provides plugins for Rails, RSpec, Sidekiq, Sinatra and other common gems.
  • 05Emits CI-native output formats such as GitHub annotations and SARIF.

Use cases

  • Finding typos and undefined method calls in an existing Ruby codebase without adding type annotations.
  • Adding a static check gate to CI with a baseline that is worked down over time.
  • Generating RBS signatures for untyped code from inferred types.
  • Running type checks on a Rails application with framework-aware plugins.

Quick start

  1. 1

    Install Rigor globally on Ruby 4.0 with mise

    mise use -g ruby@4.0 gem:rigortype
  2. 2

    Run Rigor over your code to find bugs

    rigor check app lib

Things to know

  • Early evaluation-stage release (0.4.x) with compatibility surface still subject to change before v1.0.0.
  • Maintained by a single person with limited funding, so development pace may vary.
  • Ruby-only analyzer; it does not check other languages.

In collections

Topics

FAQ

What is rigor?
Ruby static analyzer that infers types from code without annotations, aiming to report only conclusive bugs such as undefined methods and nil receivers. Rigor is a static analysis tool for Ruby that finds bugs such as calls to undefined methods, wrong argument counts, receivers that may be nil on a live path, unreachable branches, and conditions that are always truthy. It parses code with Prism and runs a flow-sensitive inference engine that tracks the values expressions produce, not only their classes. Messages include the computed value, for example reporting an undefined method on the string "hello-world" rather than on String.
Is rigor free to use? What license does it have?
rigor is open source under the MPL-2.0 license. Check the license terms before using it in commercial products.
Is rigor still maintained?
Actively maintained. The last commit to rigor was on Nov 6, 2026.
What can I use rigor for?
Finding typos and undefined method calls in an existing Ruby codebase without adding type annotations. Adding a static check gate to CI with a baseline that is worked down over time. Generating RBS signatures for untyped code from inferred types. Running type checks on a Rails application with framework-aware plugins.
How do I install rigor?
Install Rigor globally on Ruby 4.0 with mise: mise use -g ruby@4.0 gem:rigortype Run Rigor over your code to find bugs: rigor check app lib
Where can I get rigor?
The source code and installation instructions are on GitHub: https://github.com/rigortype/rigor

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects