ci,tools: improve the precision of report-missing-fn-doc, remove dependence on sed

pull/13405/head
Delyan Angelov 2022-02-08 11:28:50 +02:00
parent ff02f94fd6
commit 1dbde05267
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
2 changed files with 7 additions and 6 deletions

View File

@ -20,6 +20,8 @@ jobs:
report-missing-fn-doc: report-missing-fn-doc:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
timeout-minutes: 5 timeout-minutes: 5
env:
MOPTIONS: --no-line-numbers --relative-paths --exclude /vlib/v/ --exclude /builtin/linux_bare/ --exclude /testdata/ --exclude /tests/ vlib/
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Build V - name: Build V
@ -33,14 +35,14 @@ jobs:
- name: Check against parent commit - name: Check against parent commit
run: | run: |
./v run cmd/tools/missdoc.v --no-line-numbers vlib/ | sed -n 's@^.*/vlib/@vlib/@p' | sort > /tmp/n_v.txt ./v run cmd/tools/missdoc.v $MOPTIONS | sort > /tmp/n_v.txt
./v run cmd/tools/missdoc.v --no-line-numbers pv/vlib/ | sed -n 's@^.*/vlib/@vlib/@p' | sort > /tmp/o_v.txt cd pv/ && ../v run ../cmd/tools/missdoc.v $MOPTIONS | sort > /tmp/o_v.txt
count_new=$(cat /tmp/n_v.txt | wc -l) count_new=$(cat /tmp/n_v.txt | wc -l)
count_old=$(cat /tmp/o_v.txt | wc -l) count_old=$(cat /tmp/o_v.txt | wc -l)
echo "new pubs: $count_new | old pubs: $count_old" echo "new pubs: $count_new | old pubs: $count_old"
echo "new head: $(head -n1 /tmp/n_v.txt)" echo "new head: $(head -n1 /tmp/n_v.txt)"
echo "old head: $(head -n1 /tmp/o_v.txt)" echo "old head: $(head -n1 /tmp/o_v.txt)"
if [[ ${count_new} -gt ${count_old} ]]; then if [[ ${count_new} -gt ${count_old} ]]; then
echo "The following $((count_new-count_old)) function(s) is introduced with no documentation:" echo "The following $((count_new-count_old)) function(s) are introduced with no documentation:"
diff /tmp/n_v.txt /tmp/o_v.txt ## diff does exit(1) when files are different diff /tmp/n_v.txt /tmp/o_v.txt ## diff does exit(1) when files are different
fi fi

View File

@ -158,7 +158,6 @@ fn main() {
exclude: fp.string_multi('exclude', `e`, '') exclude: fp.string_multi('exclude', `e`, '')
relative_paths: fp.bool('relative-paths', `r`, false, 'Use relative paths in output.') relative_paths: fp.bool('relative-paths', `r`, false, 'Use relative paths in output.')
} }
dump(opt)
if opt.show_help { if opt.show_help {
println(fp.usage()) println(fp.usage())
exit(0) exit(0)