Software design reports from your recording.
Runtime Analysis measures SOLID, the Gang-of-Four patterns and the package cohesion and coupling principles from your recorded call graph. Each result gives a method or file to move and the place to move it to.
The ra CLI and CI print the full report. Over MCP,
an agent asks the same questions about a file, a class or a namespace and receives the same
text, with the findings as structured blocks. Editor hints with quick-fixes for the in-file
moves are planned.
feature_envy
Find methods that belong on another class. A method that sends most of its calls to another object and few to its own. The report names the object to move it onto, using recorded call counts.
See more →split_interface
The role interfaces in a class. Groups a class's public methods by which callers used them in the recording, and lists each group as a role interface to extract.
See more →relocate_file
Which file should move where. Two files that call each other often and are directories apart. The report names the folder they belong in, weighted by recorded call traffic and the distance between them.
See more →break_cycle
Cut a dependency cycle. The files or namespaces that form a dependency cycle at runtime. Each cycle is marked with its lowest-traffic edge, which is the cheapest one to cut.
See more →stabilize_dep
Dependencies that run against stability. A stable namespace, one with many callers and few dependencies, calling into a less stable one. Instability is computed from recorded calls, and the report lists the call sites to move or to put behind an abstraction.
See more →split_package
The parts of a namespace each consumer uses. Groups the classes in a namespace by which outside classes called them, and reports the groups that share no consumer as the lines to split the namespace along.
See more →check_diff
Check the methods a diff changed. Given a base ref, it reports the findings the changed methods introduced: a stub that no longer matches the real method, a dependency cycle, feature envy.
See more →$ ra refactor --cohesion refactor · cohesion · feature envy, file placement and cycles from 2 recorded runs ## feature envy · 2 envious methods in the recording ⚠ Enrollment#eligible_books app/models/enrollment.rb:24 4 calls to Curriculum for every 1 to itself (10 recorded calls) Curriculum level_for, books_at, archived?, prerequisites self completed_books it needs from Enrollment: completed_books (Set) → move it onto Curriculum SRP … 1 more ## file placement · app/models/enrollment.rb ⇄ app/models/student.rb 11,055 calls between them, in both directions → gather both into app/models CCP ## cycles · 1 cycle at the namespaces level ⚠ cycle · Reporting → enrollment → Reporting Enrollment#report_row → Reporting::Row#initialize 3 calls Reporting::Report#rows → Enrollment#report_row 2 calls ← cut → cut Reporting::Report#rows → Enrollment#report_row, the cheapest edge closing the cycle ADP … 5 more cycles
This is a trimmed copy of the report on the example app. The full report lists a second envious method and six cycles. Every line is computed from recorded calls: their counts, their directions and the distance between the files. The namespace of a top-level model is inferred from its file, so cycles between models are listed with the cycles between namespaces.
The report also runs on a diff. ra check reports the findings that a branch or PR
introduced, as a CLI/CI gate or over MCP, so a regression is caught in review, before release.