diff --git a/.github/workflows/docs_ci.yml b/.github/workflows/docs_ci.yml index 5f7bfb93f51ad7..c8755b2e574972 100644 --- a/.github/workflows/docs_ci.yml +++ b/.github/workflows/docs_ci.yml @@ -15,7 +15,10 @@ on: jobs: check-markdown: runs-on: ubuntu-20.04 - if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v' + if: > + github.event_name != 'push' + || github.event.ref == 'refs/heads/master' + || github.event.repository.full_name != 'vlang/v' timeout-minutes: 5 steps: - uses: actions/checkout@v3 @@ -28,10 +31,13 @@ jobs: report-missing-fn-doc: runs-on: ubuntu-20.04 - if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v' + if: > + github.event_name != 'push' + || github.event.ref == 'refs/heads/master' + || github.event.repository.full_name != 'vlang/v' timeout-minutes: 5 env: - MOPTIONS: --relative-paths --exclude /vlib/v/ --exclude /builtin/linux_bare/ --exclude /testdata/ --exclude /tests/ + MOPTIONS: --diff --deprecated --relative-paths --exclude /vlib/v/ --exclude /builtin/linux_bare/ --exclude /testdata/ --exclude /tests/ steps: - uses: actions/checkout@v3 - name: Build V @@ -46,4 +52,4 @@ jobs: - name: Check against parent commit run: | - ./v missdoc --diff $MOPTIONS pv/vlib vlib + ./v missdoc $MOPTIONS pv/vlib vlib diff --git a/cmd/tools/vmissdoc.v b/cmd/tools/vmissdoc.v index 75080c33005671..4a4c6a76238d72 100644 --- a/cmd/tools/vmissdoc.v +++ b/cmd/tools/vmissdoc.v @@ -103,12 +103,12 @@ fn (opt &Options) collect_undocumented_functions_in_path(path string) []Undocume } fn (opt &Options) report_undocumented_functions_in_path(path string) int { - mut list := opt.collect_undocumented_functions_in_path(path) - opt.report_undocumented_functions(list) - return list.len + list := opt.collect_undocumented_functions_in_path(path) + return opt.report_undocumented_functions(list) } -fn (opt &Options) report_undocumented_functions(list []UndocumentedFN) { +fn (opt &Options) report_undocumented_functions(list []UndocumentedFN) int { + mut nreports := 0 if list.len > 0 { for undocumented_fn in list { mut line_numbers := '${undocumented_fn.line}:0:' @@ -128,6 +128,7 @@ fn (opt &Options) report_undocumented_functions(list []UndocumentedFN) { } if opt.deprecated { println('${ofile}:${line_numbers}${undocumented_fn.signature} ${tags_str}') + nreports++ } else { mut has_deprecation_tag := false for tag in undocumented_fn.tags { @@ -138,10 +139,12 @@ fn (opt &Options) report_undocumented_functions(list []UndocumentedFN) { } if !has_deprecation_tag { println('${ofile}:${line_numbers}${undocumented_fn.signature} ${tags_str}') + nreports++ } } } } + return nreports } fn (opt &Options) diff_undocumented_functions_in_paths(path_old string, path_new string) []UndocumentedFN { @@ -275,8 +278,8 @@ fn main() { exit(1) } list := opt.diff_undocumented_functions_in_paths(path_old, path_new) - if list.len > 0 { - opt.report_undocumented_functions(list) + nreports := opt.report_undocumented_functions(list) + if nreports > 0 { exit(1) } exit(0)