(self, file_lines, file_path)
| 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.") |
no test coverage detected