Class: Yard::Lint::Validators::Documentation::UndocumentedMethodArguments::Validator

Inherits:
Base
  • Object
show all
Defined in:
lib/yard/lint/validators/documentation/undocumented_method_arguments/validator.rb

Overview

Runs yard list to check for missing args docs on methods that were documented

Instance Attribute Summary

Attributes inherited from Base

#config, #selection

Instance Method Summary collapse

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 where parameters.size > @param tags count.

Parameters:

  • object (YARD::CodeObjects::Base)

    the code object to query

  • collector (Executor::ResultCollector)

    collector for output



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/yard/lint/validators/documentation/undocumented_method_arguments/validator.rb', line 18

def in_process_query(object, collector)
  # Only check methods
  return unless object.type == :method
  # Skip aliases and implicit methods
  return if object.is_alias?
  return unless object.is_explicit?
  # Skip attribute methods (@!attribute directive) — their setter parameter
  # doesn't need explicit @param documentation, matching attr_accessor behavior
  return if object.is_attribute?

  # Check if parameters count exceeds @param tags count
  param_count = object.parameters.size
  param_tags_count = object.tags(:param).size

  return unless param_count > param_tags_count

  collector.puts "#{object.file}:#{object.line}: #{object.title}"
end