From 363db46c43c3662001b9a120bb7b1f0839276529 Mon Sep 17 00:00:00 2001 From: jackpoz Date: Sat, 4 Apr 2020 22:13:32 +0200 Subject: [PATCH] CI/Circle CI: Add support to multiline regex (cherry picked from commit 4f88be63e7551288f37e51928614cf14d99b444f) --- contrib/check_codestyle.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/contrib/check_codestyle.sh b/contrib/check_codestyle.sh index 02f39285cd..ce18db2d07 100644 --- a/contrib/check_codestyle.sh +++ b/contrib/check_codestyle.sh @@ -4,12 +4,20 @@ set -e echo "Codestyle check script:" echo -regexChecks=("TC_LOG_.+GetCounter") - -for check in ${regexChecks[@]}; do +singleLineRegexChecks=("TC_LOG_.+GetCounter") +for check in ${singleLineRegexChecks[@]}; do echo " Checking RegEx: '${check}'" - if grep -E -r ${check} src; then + if grep -P -r -I -n ${check} src; then + exit 1 + fi +done + +multiLineRegexChecks=("TC_LOG_[^;]+GetCounter") +for check in ${multiLineRegexChecks[@]}; do + echo " Checking RegEx: '${check}'" + + if grep -Pzo -r -I ${check} src; then exit 1 fi done