summaryrefslogtreecommitdiff
path: root/tools/file_check.py
diff options
context:
space:
mode:
authorguozhanxin <[email protected]>2021-07-12 10:14:20 +0800
committerguozhanxin <[email protected]>2021-07-12 10:14:20 +0800
commit40e7d5a23df65c15bb7db53fe5f77e76701fd20d (patch)
tree4973b28b01d289dd596a097a7560f26b810db771 /tools/file_check.py
parentddc5c793a482fe44310bafe181802ad406fa1b29 (diff)
parent5bae565f7f021ab13113fc0a9c67fc468d97de02 (diff)
Merge remote-tracking branch 'remotes/gitee/master'
Diffstat (limited to 'tools/file_check.py')
-rw-r--r--tools/file_check.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/file_check.py b/tools/file_check.py
index e79332b325..63767782b5 100644
--- a/tools/file_check.py
+++ b/tools/file_check.py
@@ -84,6 +84,7 @@ class CheckOut:
try:
os.system('git remote add rtt_repo {}'.format(self.rtt_repo))
os.system('git fetch rtt_repo')
+ os.system('git merge rtt_repo/{}'.format(self.rtt_branch))
os.system('git reset rtt_repo/{} --soft'.format(self.rtt_branch))
os.system('git status > git.txt')
except Exception as e:
@@ -144,7 +145,7 @@ class FormatCheck:
logging.warning("There are no files to check format.")
return True
encoding_check_result = True
- format_check_result = True
+ format_check_fail_files = 0
for file_path in self.file_list:
code = ''
if file_path.endswith(".c") or file_path.endswith(".h"):
@@ -166,9 +167,10 @@ class FormatCheck:
with open(file_path, 'r', encoding = "utf-8") as f:
file_lines = f.readlines()
- format_check_result = self.__check_file(file_lines, file_path)
+ if not self.__check_file(file_lines, file_path):
+ format_check_fail_files += 1
- if not encoding_check_result or not format_check_result:
+ if (not encoding_check_result) or (format_check_fail_files != 0):
logging.error("files format check fail.")
return False