MCPcopy Index your code
hub / github.com/Tencent/CodeAnalysis / get_scan_files_in_dir

Method get_scan_files_in_dir

client/node/quicktask/quickscan.py:144–160  ·  view source on GitHub ↗
(source_dir, sub_dir, exclude_regex)

Source from the content-addressed store, hash-verified

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):

Callers 1

get_scan_pathsMethod · 0.80

Calls 2

errorMethod · 0.80
get_dir_filesMethod · 0.80

Tested by

no test coverage detected