Skip to content

Commit

Permalink
[Fix](bangc-ops): update ci code format check r07. (#734)
Browse files Browse the repository at this point in the history
  • Loading branch information
DanieeelLiu authored Jun 15, 2023
1 parent 21f64a6 commit ae80e2d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 5 additions & 3 deletions tools/check_log_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import sys
import re
import warnings

lines = ''
sucess_regx = 'LOG\(ERROR\)[^}]+return MLUOP_STATUS_SUCCESS;'
Expand Down Expand Up @@ -143,10 +144,10 @@ def helper(func, reg):
"MLUOP_STATUS_EXECUTION_FAILED"
) == -1 and temp[res2.span()[1]:].find(
"MLUOP_STATUS_NOT_SUPPORTED") == -1:
print(
warnings.warn(
'-- the LOG(ERROR) may be not legal, please make sure have the correct return value'
)
print(
warnings.warn(
'-- this is just a hint, if you confirm it is correct, you can ignore it'
)
print(temp)
Expand All @@ -168,7 +169,8 @@ def check():

def main():
if sys.argv[1].endswith(".mlu") or sys.argv[1].endswith(".cpp"):
getFile(sys.argv[1])
getFile(sys.argv[1])
print('check filename: %s.'%(sys.argv[1]))
check()


Expand Down
6 changes: 5 additions & 1 deletion tools/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ bangc_gtest_json_file="jsoncppDist/"
bangc_exclude_list=${bangc_gtest_json_file}

if [[ $# -eq 1 ]]; then
filenames=$(git diff --name-only ${1} \
filenames=$(git diff --diff-filter=A --diff-filter=C --diff-filter=M \
--diff-filter=R --diff-filter=T --name-only ${1} \
| grep -v ${bangc_exclude_list} \
| grep -E ${bangc_check_list})
else
Expand Down Expand Up @@ -148,6 +149,9 @@ fi
echo "-- [check_log_error] Using tools/check_log_error.py to check the LOG(error)"
for i in $filenames; do
python tools/check_log_error.py $i
if [[ $? -ne 0 ]]; then
exit 1
fi
done

if [[ $# -eq 1 ]]; then
Expand Down

0 comments on commit ae80e2d

Please sign in to comment.