@@ -80,9 +80,9 @@ def __exclude_file(self, file_path):
8080 def get_new_file (self ):
8181 file_list = list ()
8282 try :
83- os .system ('git remote add rtt_repo {} 1>/dev/null ' .format (self .rtt_repo ))
84- os .system ('git fetch rtt_repo 1>/dev/null ' )
85- os .system ('git reset rtt_repo/{} --soft 1>/dev/null ' .format (self .rtt_branch ))
83+ os .system ('git remote add rtt_repo {}' .format (self .rtt_repo ))
84+ os .system ('git fetch rtt_repo' )
85+ os .system ('git reset rtt_repo/{} --soft' .format (self .rtt_branch ))
8686 os .system ('git status > git.txt' )
8787 except Exception as e :
8888 logging .error (e )
@@ -119,7 +119,7 @@ def __init__(self, file_list):
119119
120120 def __check_file (self , file_lines , file_path ):
121121 line_num = 1
122- check_result = False
122+ check_result = True
123123 for line in file_lines :
124124 # check line start
125125 line_start = line .replace (' ' , '' )
@@ -140,7 +140,7 @@ def check(self):
140140 logging .info ("Start to check files format." )
141141 if len (self .file_list ) == 0 :
142142 logging .warning ("There are no files to check license." )
143- return 0
143+ return True
144144 encoding_check_result = True
145145 format_check_result = True
146146 for file_path in self .file_list :
@@ -156,13 +156,13 @@ def check(self):
156156 else :
157157 continue
158158
159- if code != 'utf-8' :
159+ if code != 'utf-8' and code != 'ascii' :
160160 logging .error ("[{0}]: encoding not utf-8, please format it." .format (file_path ))
161161 encoding_check_result = False
162162 else :
163163 logging .info ('[{0}]: encoding check success.' .format (file_path ))
164164
165- with open (file_path , 'r' ) as f :
165+ with open (file_path , 'r' , encoding = "utf-8" ) as f :
166166 file_lines = f .readlines ()
167167 format_check_result = self .__check_file (file_lines , file_path )
168168
0 commit comments