openrewrite / rewrite-recipe-markdown-generator

Utility that generates OpenRewrite recipe documentation in markdown format for all recipes on the classpath.
https://docs.openrewrite.org/recipes
Apache License 2.0
2 stars 8 forks source link

Unexpected colons appear in Yaml Recipe List #113

Closed timo-a closed 7 months ago

timo-a commented 7 months ago

In the "Yaml Recipe list" of https://docs.openrewrite.org/recipes/staticanalysis/commonstaticanalysis#definition the entry org.openrewrite.staticanalysis.MethodNameCasing is rendered red (like a key) because it has a colon at the end (like a key, and unlike any other entries).

image

Curiously, that colon is not found in the sources: https://github.com/openrewrite/rewrite-static-analysis/blob/c2fffaf2929a8eafbb050ba21cb55d1b0371d12c/src/main/resources/META-INF/rewrite/common-static-analysis.yml#L48-L50 (The commented out line above immediately catches the eye, but many entries have that and don't get a colon appended...)

Impact: This is annoying when excluding a sub recipe by replacing a recipe with its parts and copying those parts from the docs.

Additional Info: I've seen this for other recipes as well -> not an isolated case. I've noticed this some time ago, whatever change caused this occurred in March or sooner.

timtebeek commented 7 months ago

Thanks a lot for reporting this! We generate the recipe documentation pages from the metadata we extract in this separate project, so I've moved the issue here.

Method name casing takes two optional arguments, none of which are provided here by default in the recipe list above. That means we likely should revisit this block where we now unconditionally add : after a sub recipe that has options, but do not display options where the value == null. https://github.com/openrewrite/rewrite-recipe-markdown-generator/blob/6953e4f0d681076b45cf6ce4bbdbbf325c001874/src/main/kotlin/org/openrewrite/RecipeDescriptorExtensions.kt#L34-L51

Should be an easy fix if you're up for it; I certainly wouldn't want to take away any of the fun of contributing, as that's how I got started. If you only wanted to point this out then we can pick this up ourselves; just let us know what you'd prefer! ❤️

/cc @mike-solomon

timo-a commented 7 months ago

Thanks for the offer, I just wanted to point this out -> won't fix it.

mike-solomon commented 7 months ago

Thanks for the report! I've gone ahead and fixed this and also updated the docs.