From a50f8d5f7ca0d089857bd09be6ad4494bf08a200 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Thu, 29 Jan 2026 00:56:26 +0200 Subject: [PATCH] tools: add support for `v missdoc @vlib` --- cmd/tools/vmissdoc.v | 10 ++++++---- vlib/v/help/common/missdoc.txt | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cmd/tools/vmissdoc.v b/cmd/tools/vmissdoc.v index b12911901..90315d25d 100644 --- a/cmd/tools/vmissdoc.v +++ b/cmd/tools/vmissdoc.v @@ -6,7 +6,7 @@ import flag const tool_name = 'v missdoc' const tool_version = '0.1.0' -const tool_description = 'Prints all V functions in .v files under PATH/, that do not yet have documentation comments.' +const tool_description = 'Prints all V functions in .v files under PATH/, that do not yet have documentation comments.\nNote: use `v missdoc @vlib`, to find public fns that still lack documentation.' const work_dir_prefix = normalise_path(os.real_path(os.wd_at_startup) + os.path_separator) struct UndocumentedFN { @@ -226,7 +226,6 @@ fn main() { fp.description(tool_description) fp.arguments_description('PATH [PATH]...') fp.skip_executable() // skip the "missdoc" command. - // Collect tool options mut opt := Options{ show_help: fp.bool('help', `h`, false, 'Show this help text.') @@ -240,9 +239,7 @@ fn main() { diff: fp.bool('diff', 0, false, 'exit(1) and show difference between two PATH inputs, return 0 otherwise.') verify: fp.bool('verify', 0, false, 'exit(1) if documentation is missing, 0 otherwise.') } - opt.additional_args = fp.finalize() or { panic(err) } - if opt.show_help { println(fp.usage()) exit(0) @@ -284,6 +281,11 @@ fn main() { } mut total := 0 for path in opt.additional_args { + if path in ['@vlib', '@cmd', '@examples'] { + rpath := path[1..] + total += opt.report_undocumented_functions_in_path(os.join_path(@VROOT, rpath)) + continue + } if os.is_file(path) || os.is_dir(path) { total += opt.report_undocumented_functions_in_path(path) } diff --git a/vlib/v/help/common/missdoc.txt b/vlib/v/help/common/missdoc.txt index e4f8bb065..69c09b879 100644 --- a/vlib/v/help/common/missdoc.txt +++ b/vlib/v/help/common/missdoc.txt @@ -34,3 +34,5 @@ between commits or branches: ``` v missdoc --diff current/code new/code ``` + +Note: use `v missdoc @vlib`, to find public fns that still lack documentation. \ No newline at end of file -- 2.39.5