Skip to content

Instantly share code, notes, and snippets.

@wilsonsilva
Created July 3, 2026 04:06
Show Gist options
  • Select an option

  • Save wilsonsilva/96a74965b3268d552260b47e5d2f2794 to your computer and use it in GitHub Desktop.

Select an option

Save wilsonsilva/96a74965b3268d552260b47e5d2f2794 to your computer and use it in GitHub Desktop.
rake yard:strict
namespace :yard do
desc "Generate YARD docs and fail unless every object (incl. private) is documented"
task strict: :yard do
require "open3"
out, = Open3.capture2("yard", "stats", "--list-undoc", "--private", "--protected")
puts out
coverage = out[/([\d.]+)% documented/, 1]&.to_f
abort "yard:strict could not parse coverage from `yard stats` output" if coverage.nil?
abort "yard:strict failed: #{coverage}% documented (< 100%)" if coverage < 100.0
end
end
rescue LoadError
# YARD is a development dependency; its tasks are simply unavailable without it.
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment