Class: Yard::Lint::Validators::Documentation::UndocumentedObjects::Parser
- Inherits:
-
Parsers::Base
- Object
- Parsers::Base
- Yard::Lint::Validators::Documentation::UndocumentedObjects::Parser
- Defined in:
- lib/yard/lint/validators/documentation/undocumented_objects/parser.rb
Overview
Class used to extract details about undocumented objects from raw yard list output
Constant Summary collapse
- LINE_REGEX =
Regex used to parse yard list output format Format: file.rb:LINE: ObjectName or ObjectName|ARITY
/^(.+):(\d+): (.+?)(?:\|(\d+))?$/
Instance Method Summary collapse
-
#call(yard_list_output, config: nil, **_kwargs) ⇒ Array<Hash>
Array with undocumented objects details.
Methods inherited from Parsers::Base
Instance Method Details
#call(yard_list_output, config: nil, **_kwargs) ⇒ Array<Hash>
Returns Array with undocumented objects details.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/yard/lint/validators/documentation/undocumented_objects/parser.rb', line 21 def call(yard_list_output, config: nil, **_kwargs) excluded_methods = config&.validator_config( 'Documentation/UndocumentedObjects', 'ExcludedMethods' ) || [] # Ensure excluded_methods is an Array excluded_methods = Array(excluded_methods) # Sanitize patterns: remove nil, empty, whitespace-only, and normalize excluded_methods = sanitize_patterns(excluded_methods) yard_list_output .split("\n") .map(&:strip) .reject(&:empty?) .filter_map do |line| match = line.match(LINE_REGEX) next unless match element = match[3] arity = match[4]&.to_i # Skip if method is in excluded list next if method_excluded?(element, arity, excluded_methods) { location: match[1], line: match[2].to_i, element: element } end end |