Skip to content
Arxo Arxo

Refactoring Suggestions

Arxo can generate concrete refactoring suggestions from the Ricci curvature metric. This is useful after running an analysis with ricci_curvature enabled and exporting JSON.

  1. Run analysis with the ricci_curvature metric and JSON output:

    metrics:
    - id: ricci_curvature
    enabled: true
    report:
    format: json
    file: report.json
  2. The JSON report contains Ricci curvature results, including:

    • Flagged edges (e.g. negative curvature, high risk)
    • Peripheral coupling issues (core-periphery violations)
  3. Tooling can read this JSON and produce human-readable refactoring suggestions: which edges to review, call sites involved, and recommended actions (e.g. introduce interface, move code).

Suggestions typically include:

  • Edge: From-module → To-module
  • Risk score / category: From Ricci curvature and peripheral analysis
  • Call sites: File and symbol for callers and callees, with call counts
  • Details: Short explanations and concrete steps (e.g. break dependency, reduce coupling)

The JSON report structure includes metrics[] with id: "ricci_curvature". Under ui_schema.issues.categories you find:

  • flagged_for_review: edges flagged by Ricci curvature
  • peripheral_coupling: core-periphery coupling issues

Each issue has from, to, and optional entity/call information that can be turned into refactoring suggestions (e.g. via a script or the internal suggest_refactors API).