-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document that disable comments can include a descriptive comment #11590
base: master
Are you sure you want to change the base?
Conversation
@@ -739,11 +739,11 @@ Running `rubocop --autocorrect --disable-uncorrectable` will | |||
create comments to disable all offenses that can't be automatically | |||
corrected. | |||
|
|||
Do not write anything other than cop name in the disabling comment. E.g.: | |||
Add a comment to explain why the cop has been disabled E.g.: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd change the wording to something like "You can also...", so it sounds like a suggestion. I think you removed the .
before e.g. by accident.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
馃憤馃徎 I updated the language to be You can also include...
and re-added the period.
6a7d8df
to
342b438
Compare
@bbatsov I did some more digging into the git history and learned that the documentation I'm updating is actually much more recent than expected. It was introduced in 2020: #7995, whereas the behavior to allow the descriptive text was introduced in 2016. Am I being accurate that disabling comments are intended to accept an additional "reason/comment"? |
Yeah, it seems that actually that's not really supported. My bad. I keep forgetting how certain features work. @koic can add more on the topic I guess. |
@koic Agreed. |
That sounds like it is a supported feature, but not recommended (very Rubocop-y 馃槃 ). I can try to capture that in the documentation. Is the reason purely that it's prone-to-breakage? I think the trailing reason comment is very useful to have on the same-line (it's visually closest to the code being commented; it could be removed via I see two options and I'd like your advice:
Thanks for chatting through this with me! |
For me the main problem is that this makes sense only for a single cop/department being listed on the line, but what happens if you have several? And obviously it's easier to parse the directive contents if you know there's no free-form text somewhere in there. I do get your point, however, and I wonder what's the best approach in general. Normally I put some explanatory comments before directives and that seems fine to me overall. |
Updates the documentation to reflect that disabling comments can include descriptive text after the cop name. This feature was introduced in #3191 and as far as I can tell is still supported.
This is only a documentation update, I'll do my best to pick the relevant tasks below 馃檱馃徎
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).bundle exec rake default
. It executes all tests and runs RuboCop on its own code.{change_type}_{change_description}.md
if the new code introduces user-observable changes. See changelog entry format for details.