Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add a gate for Hashbtl.find
Signed-off-by: Andrii Sultanov <[email protected]>
  • Loading branch information
Andrii Sultanov committed Jul 4, 2024
commit d4be15e09702ab5be5bf68c7a2b786a0883b0758
14 changes: 14 additions & 0 deletions quality-gate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,19 @@ unixgetenv () {
fi
}

hashtblfind () {
N=36
# Looks for all .ml files except the ones using Core.Hashtbl.find,
# which already returns Option
HASHTBLFIND=$(git grep -P -r --count 'Hashtbl.find(?!_opt)' -- '**/*.ml' ':!ocaml/xapi-storage-script/main.ml' | cut -d ':' -f 2 | paste -sd+ - | bc)
if [ "$HASHTBLFIND" -eq "$N" ]; then
echo "OK counted $HASHTBLFIND usages of exception-raising Hashtbl.find"
else
echo "ERROR expected $N usages of exception-raising Hashtbl.find, got $HASHTBLFIND" 1>&2
exit 1
fi
}

list-hd
verify-cert
mli-files
Expand All @@ -112,4 +125,5 @@ vtpm-unimplemented
vtpm-fields
ocamlyacc
unixgetenv
hashtblfind