Laser: Static Analysis for Ruby, in Ruby
summary
Laser is a Ruby-implemented static analyzer that builds a control flow graph and rewrites it into static single assignment form to do flow-sensitive analyses; it runs top-level code until IO, duplicates CFGs per-type using a cartesian product algorithm, and then answers concrete questions like which methods are unused, which variables are dead, which methods may raise, and whether a method is block required/optional/ignored/foolish. The CFG builder is a single ~2,500-line file; dead-variable analysis is ~55 lines, block-usage is ~79 lines; it works on MRI 1.9.3, finds real bugs, but is currently slow and not Rails-ready.
AI-written summary · about
chapters (13)
- 0:00Introduction to Laser
- 1:08Principles of static analysis
- 2:27Motivations and challenges
- 5:45Addressing metaprogramming
- 8:44Control flow and architecture
- 14:04Representing the object model
- 16:19Cartesian product algorithm
- 20:26Bug discovery and dead code
- 25:36Analyzing block usage
- 30:45Simulation and performance
- 33:40Project challenges
- 40:44Future potential of Laser
- 43:51Live demo and Q&A








