(source_dir, sub_dir, exclude_regex)
| 142 | |
| 143 | @staticmethod |
| 144 | def get_scan_files_in_dir(source_dir, sub_dir, exclude_regex): |
| 145 | dir_path = os.path.join(source_dir, sub_dir) |
| 146 | if not dir_path.startswith(source_dir): |
| 147 | LogPrinter.error(f"Wrong dir: {sub_dir}, skip!") |
| 148 | return [] |
| 149 | file_paths = PathMgr().get_dir_files(dir_path) |
| 150 | relpos = len(source_dir) + 1 |
| 151 | task_params = { |
| 152 | "path_filters": { |
| 153 | "inclusion": [], |
| 154 | "exclusion": exclude_regex |
| 155 | } |
| 156 | } |
| 157 | filtered_paths = FilterPathUtil(task_params).get_include_files(file_paths, relpos) |
| 158 | rel_paths = [path[relpos:] for path in filtered_paths] |
| 159 | # logger.info(f"{len(rel_paths)} files in {sub_dir} to scan: {rel_paths}") |
| 160 | return rel_paths |
| 161 | |
| 162 | @staticmethod |
| 163 | def get_path_filters(input_params=None): |
no test coverage detected