MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / __check_file

Method __check_file

tools/ci/file_check.py:131–150  ·  view source on GitHub ↗
(self, file_lines, file_path)

Source from the content-addressed store, hash-verified

129 return True
130
131 def __check_file(self, file_lines, file_path):
132 line_num = 0
133 check_result = True
134 for line in file_lines:
135 line_num += 1
136 # check line start
137 line_start = line.replace(' ', '')
138 # find tab
139 if line_start.startswith('\t'):
140 logging.error("{} line[{}]: please use space replace tab at the start of this line.".format(file_path, line_num))
141 check_result = False
142 # check line end
143 line_end = line.split('\n')[0]
144 if line_end.endswith(' ') or line_end.endswith('\t'):
145 logging.error("{} line[{}]: please delete extra space at the end of this line.".format(file_path, line_num))
146 check_result = False
147 if self.__check_rt_errorcode(line) == False:
148 logging.error("{} line[{}]: the RT-Thread error code should return negative value. e.g. return -RT_ERROR".format(file_path, line_num))
149 check_result = False
150 return check_result
151
152 def check(self):
153 logging.info("Start to check files format.")

Callers 1

checkMethod · 0.95

Calls 1

__check_rt_errorcodeMethod · 0.95

Tested by

no test coverage detected