From 3e5e2b52eae39a27092c35528489f37b67179fc1 Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Sun, 20 Oct 2024 13:27:08 -0700 Subject: [PATCH] lint: catch NOMERGE comments (#33820) * nomerge * Update modeld.py --- scripts/lint/check_nomerge_comments.sh | 10 ++++++++++ scripts/lint/lint.sh | 1 + 2 files changed, 11 insertions(+) create mode 100755 scripts/lint/check_nomerge_comments.sh diff --git a/scripts/lint/check_nomerge_comments.sh b/scripts/lint/check_nomerge_comments.sh new file mode 100755 index 0000000000..6737d62a20 --- /dev/null +++ b/scripts/lint/check_nomerge_comments.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +FAIL=0 + +if grep -n '\(#\|//\)\([[:space:]]*\)NOMERGE' $@; then + echo -e "NOMERGE comments found! Remove them before merging\n" + FAIL=1 +fi + +exit $FAIL diff --git a/scripts/lint/lint.sh b/scripts/lint/lint.sh index 4b65e4a895..578c63cd18 100755 --- a/scripts/lint/lint.sh +++ b/scripts/lint/lint.sh @@ -52,6 +52,7 @@ function run_tests() { run "check_added_large_files" python3 -m pre_commit_hooks.check_added_large_files --enforce-all $ALL_FILES --maxkb=120 run "check_shebang_scripts_are_executable" python3 -m pre_commit_hooks.check_shebang_scripts_are_executable $ALL_FILES run "check_shebang_format" $DIR/check_shebang_format.sh $ALL_FILES + run "check_nomerge_comments" $DIR/check_nomerge_comments.sh $ALL_FILES if [[ -z "$FAST" ]]; then run "mypy" mypy $PYTHON_FILES