Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make enforcement of colon after comment annotation configurable #9890

Closed
mojavelinux opened this issue Jun 23, 2021 · 2 comments · Fixed by #9899
Closed

Make enforcement of colon after comment annotation configurable #9890

mojavelinux opened this issue Jun 23, 2021 · 2 comments · Fixed by #9899
Labels
feature request good first issue Easy task, suitable for newcomers to the project

Comments

@mojavelinux
Copy link

If the Style/CommentAnnotation rule is enabled, RuboCop requires that the annotation name be followed by a colon. In both the IntelliJ IDEs and the Eclipse IDE, the convention is to omit the colon. (See https://www.jetbrains.com/help/idea/using-todo.html and https://www.vogella.com/tutorials/Eclipse/article.html#task-management). It's fair to say that omitting the colon is also a well-established convention (especially in mixed programming language teams). However, if we write comment annotations (aka task tags) this way, this RuboCop rule is not usable since it gets stuck on the missing colon (rather than the annotation names).

I wish to see an enforced style (or something of the sort) that allows the colon to be omitted. The rule can then still fulfill its primary function while accommodating this style variation.

What we are talking about is being able to reverse the bad and good cases in the cited section of the Ruby style guide: https://rubystyle.guide/#annotate-keywords

@bbatsov bbatsov added feature request good first issue Easy task, suitable for newcomers to the project labels Jun 23, 2021
@bbatsov
Copy link
Collaborator

bbatsov commented Jun 23, 2021

I'm fine with making this configurable. I've also noticed that in other communities it's quite common to write those annotations sans the :.

gregfletch added a commit to gregfletch/rubocop that referenced this issue Jun 30, 2021
Make the separator for the Style/CommentAnnotation cop configurable. By default, the enforced style will be the current behaviour of annotation keyword followed by a colon (`:`), and a space. A new supported style is added to only require a space following the annotation keyword.
gregfletch added a commit to gregfletch/rubocop that referenced this issue Jun 30, 2021
…on to a boolean flag indicating whether or not a colon separator is required.
bbatsov pushed a commit that referenced this issue Jul 1, 2021
Make the separator for the Style/CommentAnnotation cop configurable. By default, the enforced style will be the current behaviour of annotation keyword followed by a colon (`:`), and a space.
@themilkman
Copy link
Contributor

Generally great option.
Wouldn't an "ignore" parameter make sense? Instead of forcing color or forbidding it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request good first issue Easy task, suitable for newcomers to the project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants