MCPcopy
hub / github.com/Tencent/CodeAnalysis / filte_worker

Method filte_worker

client/task/basic/datahandler/filter.py:162–192  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

160 que = Queue()
161
162 def filte_worker():
163
164 while not que.empty():
165 fileissue = que.get()
166 path = fileissue.get("path", False)
167 if not path:
168 que.task_done()
169 continue
170 path_format = path.replace(os.sep, "/")
171
172 # 根据include和exclude判断path是否需要过滤
173 if filter_util.should_filter_path(path_format):
174 logger.info("match excluded path, ignore. %s", path_format)
175 que.task_done()
176 continue
177
178 # 过滤不在版本控制下的文件
179 # 该方法的主要耗时来源
180 if not os.getenv("TCA_UNCOMMITTED_CODE") == "True":
181 try:
182 if scm_mgr.check_versioned_file(path_format) is False:
183 logger.info("not versioned path, ignore. %s", path_format)
184 que.task_done()
185 continue
186 except Exception as e:
187 logger.exception("check_versioned_file exception: %s - %s", str(e), path)
188 # 判断异常,当做不过滤处理
189
190 fileissue["path"] = path_format
191 filtered_issues.append(fileissue)
192 que.task_done()
193
194 thread_num = cpu_count()
195 for fileissue in issues:

Callers

nothing calls this directly

Calls 4

exceptionMethod · 0.80
getMethod · 0.45
infoMethod · 0.45
check_versioned_fileMethod · 0.45

Tested by

no test coverage detected