Class: Yard::Lint::Validators::Documentation::UndocumentedOptions::Validator
- Inherits:
-
Base
- Object
- Base
- Yard::Lint::Validators::Documentation::UndocumentedOptions::Validator
- Defined in:
- lib/yard/lint/validators/documentation/undocumented_options/validator.rb
Overview
Validates that methods with options hash parameters have @option tags
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#in_process_query(object, collector) ⇒ void
Execute query for a single object during in-process execution.
Methods inherited from Base
in_process, in_process?, in_process_visibility, #initialize, validator_name
Constructor Details
This class inherits a constructor from Yard::Lint::Validators::Base
Instance Method Details
#in_process_query(object, collector) ⇒ void
This method returns an undefined value.
Execute query for a single object during in-process execution. Finds methods with options parameters but no @option tags.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/yard/lint/validators/documentation/undocumented_options/validator.rb', line 18 def in_process_query(object, collector) # Only check method objects return unless object.is_a?(YARD::CodeObjects::MethodObject) params = object.parameters || [] # Check for options-style parameters = params.any? do |p| param_name = p[0].to_s # Match options, option, opts, opt, kwargs or double-splat (**) param_name.match?(/^(options?|opts?|kwargs)$/) || param_name.start_with?('**') end return unless # Check if @option tags are missing = object.(:option) return unless .empty? # Output method location and parameter info collector.puts "#{object.file}:#{object.line}: #{object.title}" collector.puts params.map { |p| p.join(' ') }.join(', ') end |