MCPcopy Create free account
hub / github.com/Tencent/CodeAnalysis / get_scan_files

Method get_scan_files

client/tool/util/pythontool.py:186–209  ·  view source on GitHub ↗
(params)

Source from the content-addressed store, hash-verified

184
185 @staticmethod
186 def get_scan_files(params):
187 source_dir = params['source_dir']
188 incr_scan = params['incr_scan']
189 relpos = len(source_dir) + 1
190 want_suffix = ['.py']
191 # 获取需要扫描的文件
192 if incr_scan:
193 diffs = SCMMgr(params).get_scm_diff()
194 toscans = [diff.path.replace(os.sep, '/') for diff in diffs
195 if diff.path.endswith(tuple(want_suffix)) and diff.state != 'del']
196 else:
197 toscans = [path.replace(os.sep, '/')[relpos:]
198 for path in PathMgr().get_dir_files(source_dir, tuple(want_suffix))]
199
200 toscans = [os.path.join(source_dir, path) for path in toscans]
201
202 # filter include and exclude path
203 toscans = FilterPathUtil(params).get_include_files(toscans, relpos)
204
205 # bugfix - 在文件前后加上双引号,变成字符串,防止文件路径中有空格,pylint无法扫描
206 toscans = [PythonTool.handle_path_with_space(path) for path in toscans]
207
208 LogPrinter.info('待扫描文件数: %d' % len(toscans))
209 return toscans
210
211 @staticmethod
212 def handle_path_with_space(path):

Callers 2

analyzeMethod · 0.80
analyzeMethod · 0.80

Calls 3

get_dir_filesMethod · 0.80
infoMethod · 0.45

Tested by

no test coverage detected