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

Method _modify_include_paths

client/node/servertask/looprunner.py:143–156  ·  view source on GitHub ↗

(适配大仓场景)将scan_path添加到过滤路径include中,指定扫描对应的目录

(self, task_request)

Source from the content-addressed store, hash-verified

141 # Reporter(task_request['task_params']).update_task_progress(InfoType.TaskDone)
142
143 def _modify_include_paths(self, task_request):
144 """(适配大仓场景)将scan_path添加到过滤路径include中,指定扫描对应的目录"""
145 task_params = task_request['task_params']
146 scan_path = task_params.get("scan_path")
147 if scan_path: # 判空,避免值为None的情况
148 # 删除前后空格
149 scan_path = scan_path.strip()
150 # 如果包含头尾斜杠,去掉(包含默认扫描整个仓库时的传值/)
151 scan_path = scan_path.strip('/')
152 if scan_path:
153 format_scan_path = f"{scan_path}/*"
154 include_paths = task_params["path_filters"]["inclusion"]
155 if format_scan_path not in include_paths: # 如果有上一阶段,已经添加到include路径,不需要重复添加
156 include_paths.append(format_scan_path)
157
158 def run(self):
159 """looprunner主函数"""

Callers 1

runMethod · 0.95

Calls 1

getMethod · 0.45

Tested by

no test coverage detected