tools: improve summary output of find_doc_comments_with_no_dots.v

This commit is contained in:
Delyan Angelov 2025-07-02 15:44:44 +03:00
parent 7f53acfec8
commit e6bbcbd168

View file

@ -22,7 +22,7 @@ fn main() {
continue continue
} }
} }
println('> Processed ${fpaths.len} .v files, found errors: ${ctx.errors} .') println('> Processed ${fpaths.len} .v files, found errors: ${ctx.errors} , in ${ctx.pub_symbols} `pub` declarations, and ${ctx.pub_comment_lines} pub comment lines.')
if ctx.errors > 0 { if ctx.errors > 0 {
exit(1) exit(1)
} }
@ -31,6 +31,9 @@ fn main() {
struct Context { struct Context {
mut: mut:
errors int errors int
pub_symbols int
pub_comment_lines int
comments int
} }
fn (mut ctx Context) process_fpath(filepath string) ! { fn (mut ctx Context) process_fpath(filepath string) ! {
@ -38,6 +41,7 @@ fn (mut ctx Context) process_fpath(filepath string) ! {
mut prev := 0 mut prev := 0
for iline, line in lines { for iline, line in lines {
if line.starts_with('pub ') { if line.starts_with('pub ') {
ctx.pub_symbols++
mut comments := []CommentLine{} mut comments := []CommentLine{}
mut i := 0 mut i := 0
for i = int_max(0, iline - 1); i >= prev; i-- { for i = int_max(0, iline - 1); i >= prev; i-- {
@ -55,6 +59,7 @@ fn (mut ctx Context) process_fpath(filepath string) ! {
if !line.contains(fword) { if !line.contains(fword) {
continue continue
} }
ctx.pub_comment_lines += comments.len
if !cline.comment.ends_with('.') { if !cline.comment.ends_with('.') {
println('${filepath}:${cline.line}: ${cline.comment}') println('${filepath}:${cline.line}: ${cline.comment}')
ctx.errors++ ctx.errors++