class RDoc::Checker
RDoc::Checker collects documentation quality check warnings during RDoc execution. Warnings are reported at the end and cause a non-zero exit status.
Example usage:
RDoc::Checker.add("Missing reference", file: "lib/foo.rb", line: 42)
At the end of rdoc execution, if any warnings were added, they will be printed and the process will exit with status 1.
Public Class Methods
Source
# File lib/rdoc/checker.rb, line 48 def add(message, file: nil, line: nil) @warnings << Warning.new(message, file: file, line: line) end
Add a warning to the checker.
message - The warning message file - Optional file path where the issue was found line - Optional line number where the issue was found
Source
# File lib/rdoc/checker.rb, line 69 def any? @warnings.any? end
Returns true if any warnings have been collected.
Source
# File lib/rdoc/checker.rb, line 62 def clear @warnings = [] end
Clear all warnings. Used between test runs.
Source
# File lib/rdoc/checker.rb, line 77 def report return if @warnings.empty? puts puts "Documentation check failures:" @warnings.each do |warning| puts " #{warning}" end puts puts "#{@warnings.size} check(s) failed" end
Print all collected warnings to stdout. Returns early if no warnings exist.
Source
# File lib/rdoc/checker.rb, line 55 def warnings @warnings end
Returns all collected warnings.