rewrite-static-analysis icon indicating copy to clipboard operation
rewrite-static-analysis copied to clipboard

Recipe to unify spaces after single-line `//` comment start

Open greg-at-moderne opened this issue 3 months ago • 2 comments

What problem are you trying to solve?

Unify the usage of space after the // single-line comment start and the actual text.

I prefer there's a space. IMHO this is the industry standard. While some code doesn't use it.

If it was up to me, I'd implement the recipe as enforcing a single space. But I can imagine someone'd call for it to be configurable.

Describe the situation before applying the recipe

//Find the first partition with a recipe run
...
// Link to the commit trace if it exists
...

Describe the situation after applying the recipe

// Find the first partition with a recipe run
...
// Link to the commit trace if it exists
...

Any additional context

Watch out, there might be some conventions or not-for-human comments which might actually require no space, e.g.

        //language=java

greg-at-moderne avatar Oct 13 '25 14:10 greg-at-moderne

Might also want to take into account cases like the following, where you wouldn't want to shift the code left

//                             SomeIndented.butCommentedOut(code);

timtebeek avatar Oct 13 '25 16:10 timtebeek

Yeah. For this I guess the safest is to only alter cases where there's exactly 0 space. Disregard cases with >1 spaces

greg-at-moderne avatar Oct 13 '25 16:10 greg-at-moderne