rubocop / rubocop-ast

RuboCop's AST extensions and NodePattern functionality
https://docs.rubocop.org/rubocop-ast
MIT License
112 stars 53 forks source link

Move `rubocop:disable` comments out of documentation #299

Closed sambostock closed 5 months ago

sambostock commented 5 months ago

When rubocop:disable is used immediately above a method or module declaration, it becomes part of the documentation.

e.g. Node#value_used?

image

Instead, if we inline it with the declaration itself, it is not included in the documentation. As a side benefit, RuboCop attaches it to that declaration only, removing the need to rubocop:enable afterwards.

However, YARD applies it as documentation to whatever immediately follows, so if the next declaration is public, we must explicitly document it, so YARD properly ignores the rubocop:disable comment.

marcandre commented 5 months ago

Thank you.