Skip to content

Enforce at least one space after comment symbol - #951

Merged
froydnj merged 2 commits into
trunkfrom
aadi-spaces
Jul 29, 2026
Merged

Enforce at least one space after comment symbol#951
froydnj merged 2 commits into
trunkfrom
aadi-spaces

Conversation

@aadi-stripe

@aadi-stripe aadi-stripe commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Autoformats comments to have at least one space after # for better readability, i.e.:

#comment

will be formatted to:

# comment

Note: the space is added after the first non-# leading character, i.e.:

###comment

✅ will be formatted to:

### comment

and not to:

# ##comment

A few exceptions will be untouched, since these hold special meaning or count as convention:

#!
#-
#=
#:

@fables-tales

Copy link
Copy Markdown
Owner

@reese peaceful?

@reese

reese commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Peaceful with the concept, there's still some stuff to fix in the PR (which is why I assume it's a draft), such as exempting shebang comments from this (I don't think something like # !/usr/bin/env ruby works or is preferable) but I'm cool with this as a thing for regular comments

@aadi-stripe

Copy link
Copy Markdown
Collaborator Author

Peaceful with the concept, there's still some stuff to fix in the PR (which is why I assume it's a draft), such as exempting shebang comments from this (I don't think something like # !/usr/bin/env ruby works or is preferable) but I'm cool with this as a thing for regular comments

Yep, still working on this

@aadi-stripe
aadi-stripe force-pushed the aadi-spaces branch 6 times, most recently from dade4ad to bc04e81 Compare July 27, 2026 22:59
@jez

jez commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Another load bearing sigil is #: for type annotations

https://sorbet.org/docs/rbs-support

@aadi-stripe
aadi-stripe force-pushed the aadi-spaces branch 2 times, most recently from 38401b4 to a4b4db5 Compare July 27, 2026 23:23
@aadi-stripe
aadi-stripe marked this pull request as ready for review July 27, 2026 23:46
Comment thread librubyfmt/src/comment_block.rs Outdated
Comment thread librubyfmt/src/comment_block.rs Outdated
@reese

reese commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

LGTM besides the nits above. I'm gonna leave this for Stripe folks (r? @fables-tales || @froydnj) to give final approval to make sure it aligns with whatever style expectations y'all have agreed on.

@aadi-stripe

Copy link
Copy Markdown
Collaborator Author

LGTM besides the nits above. I'm gonna leave this for Stripe folks (@fables-tales || @froydnj) to give final approval to make sure it aligns with whatever style expectations y'all have agreed on.

@reese Thank you! And also, 👋

@reese reese assigned froydnj and unassigned reese Jul 28, 2026
Comment thread librubyfmt/src/comment_block.rs Outdated
@froydnj
froydnj merged commit f31f576 into trunk Jul 29, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants