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
[Fix #6708] Style/CommentedKeyword knows :yields: #6735
Conversation
@@ -59,7 +59,7 @@ def investigate(processed_source) | |||
private | |||
|
|||
KEYWORDS = %w[begin class def end module].freeze | |||
ALLOWED_COMMENTS = %w[:nodoc: rubocop:disable].freeze | |||
ALLOWED_COMMENTS = %w[:nodoc: :yields: rubocop:disable].freeze |
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.
This change also update the document.
https://github.com/rubocop-hq/rubocop/blob/v0.63.1/lib/rubocop/cop/style/commented_keyword.rb#L9
And it may be better to be able to customize with default.yml (.rubocop.yml) in the future :-)
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.
The document says “such as :nodoc:
and rubocop:disable
”, which I thought means it doesn’t need to list all allowed comments. Would you prefer listing all allowed comments there? E.g.
# Note that some comments (`:nodoc:`, `:yields:, and `rubocop:disable`)
# are allowed.
I wouldn’t go for full customization (giving an array in default.yml) just yet. I’d be interested to see – when a bug is reported – which kind of comment would need to be added to the list.
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.
Would you prefer listing all allowed comments there? E.g.
Yes. I think that's fine.
when a bug is reported – which kind of comment would need to be added to the list.
OK. Let's think about it at that time.
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’ve pushed the new documentation.
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.
Thanks for quick updating!
733f898
to
30075e1
Compare
The `Style/CommentedKeyword` cop would not allow the `:yields:` RDoc directive as a trailing comment (to `def`). The documentation https://docs.ruby-lang.org/ en/2.1.0/RDoc/Markup.html#class-RDoc::Markup-label-Directives lists many, many directives, but only `:nodoc:` and `:yields:` are shown as trailing comments.
30075e1
to
500215c
Compare
The
Style/CommentedKeyword
cop would not allow the:yields:
RDoc directive as a trailing comment (todef
). The documentation https://docs.ruby-lang.org/en/2.1.0/RDoc/Markup.html#class-RDoc::Markup-label-Directives lists many, many directives, but only:nodoc:
and:yields:
are shown as trailing comments.Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).and description in grammatically correct, complete sentences.
bundle exec rake default
. It executes all tests and RuboCop for itself, and generates the documentation.