openrewrite / rewrite-analysis

OpenRewrite recipes for data flow analysis.
Apache License 2.0
7 stars 8 forks source link

Control Flow Visualization generated as comment as opposed to new stand alone file #69

Open Jothianand opened 1 month ago

Jothianand commented 1 month ago

Dot file is not generated while running the Control Flow Visualization recipe.

After running the recipe, it is adding the diagraph notations to the class but the dot file is not generated.

Have tried with both includeDotfile as true & false, but not generating the file. When includeDotfile is true, its adding diagraph notions and when false, it is not added.

Do we need to use a separate recipe to generate the dot file from the notations added by the recipe ?

---
type: specs.openrewrite.org/v1beta/recipe
name: com.yourorg.ControlFlowVisualizationExample
displayName: Control Flow Visualization example
recipeList:
  - org.openrewrite.analysis.controlflow.ControlFlowVisualization:
      includeDotfile: true
timtebeek commented 1 month ago

It indeed looks like the recipe produces the dot notation as a comment in the code, as opposed to in a separate file, as seen here: https://github.com/openrewrite/rewrite-analysis/blob/9ced24c381ac232ce0d670a314a980f8cc14b5c5/src/main/java/org/openrewrite/analysis/controlflow/ControlFlowVisualizationVisitor.java#L82-L90

We could restructure the recipe to be a Scanning recipe that creates a new file instead of a comment, if you feel that improves the experience. I'd welcome a PR that explores that solution to this issue.

Jothianand commented 1 month ago

Thanks @timtebeek for the response.

I feel that the recipe should generate the dot file so that developers can visualise their code flow.