Class: RuboCop::Cop::Yardoc::YieldDocumentation
- Includes:
- RuboCop::Cop::YardHelp
- Defined in:
- lib/rubocop/cop/yardoc/yield_documentation.rb
Overview
Ensures methods that yield a block document it with @yield.
Also checks for @yieldparam when the yield passes arguments, and @yieldreturn when the yield's return value is used.
Constant Summary collapse
- MSG_YIELD =
'Method yields a block but is missing a @yield tag.'- MSG_YIELDPARAM =
'Method yields with arguments but is missing @yieldparam tags.'
Instance Method Summary collapse
-
#on_def(node) ⇒ Object
(also: #on_defs)
Executed for every method definition.
Instance Method Details
#on_def(node) ⇒ Object Also known as: on_defs
Executed for every method definition
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/rubocop/cop/yardoc/yield_documentation.rb', line 44 def on_def(node) return unless yields?(node) return unless documented?(node) = (node) unless .any? { |t| t.tag_name == 'yield' } add_offense(node, message: MSG_YIELD) return end check_yieldparams(node, ) if require_param_documentation? end |