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

Method __prepare_cpplint_args

client/tool/cpplint.py:190–224  ·  view source on GitHub ↗

准备cpplint命令行执行参数 :param source_dir: :param rules: :return:

(self, source_dir, rules, linelength, project_name)

Source from the content-addressed store, hash-verified

188 )
189
190 def __prepare_cpplint_args(self, source_dir, rules, linelength, project_name):
191 """
192 准备cpplint命令行执行参数
193 :param source_dir:
194 :param rules:
195 :return:
196 """
197 # 可以设置使用用户自己维护的cpplint,但需要注意的是 用户的cpplint独有的规则,可能会被过滤掉
198 cpplint_path = os.environ.get("CPPLINT_PATH", None)
199 if cpplint_path:
200 cpplint_path = os.path.join(source_dir, cpplint_path)
201 else:
202 # 默认使用puppy集成的版本
203 cpplint_path = os.path.join(os.environ.get("CPPLINT_HOME"), "cpplint.py")
204
205 cmd_args = [
206 "python",
207 "\"%s\"" % cpplint_path,
208 "--repository=\"%s\"" % source_dir,
209 "--linelength=%s" % linelength,
210 "--headers=h,hpp,cuh,hxx,h++",
211 ]
212
213 file_extensions = os.environ.get("EXTENSIONS")
214 if file_extensions:
215 cmd_args.append("--extensions=" + file_extensions)
216 logger.info("扫描文件为 %s" % file_extensions)
217 if project_name:
218 if project_name.find(".git") != -1:
219 project_name = project_name.replace(".git", "")
220 cmd_args.append("--root=%s" % project_name)
221 if rules:
222 filter_arg = "--filter=-,+" + ",+".join(rules)
223 cmd_args.append(filter_arg)
224 return cmd_args
225
226 def __get_linelength_param(self, params):
227 """

Callers 1

analyzeMethod · 0.95

Calls 2

getMethod · 0.45
infoMethod · 0.45

Tested by

no test coverage detected