Class: Yard::Lint::Validators::Documentation::UndocumentedObjects::Validator

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

Overview

Runs yard list to check for undocumented objects

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. Checks for empty docstrings and outputs location with arity for methods.

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
# File 'lib/yard/lint/validators/documentation/undocumented_objects/validator.rb', line 18

def in_process_query(object, collector)
  # Check if docstring is empty
  return unless object.docstring.all.empty?

  if object.is_a?(YARD::CodeObjects::MethodObject)
    # For methods, include arity (excluding splat and block params)
    arity = object.parameters.reject { |p| p[0].to_s.start_with?('*', '&') }.size
    collector.puts "#{object.file}:#{object.line}: #{object.title}|#{arity}"
  else
    collector.puts "#{object.file}:#{object.line}: #{object.title}"
  end
end