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

Method analyze

client/tool/util/infer.py:98–249  ·  view source on GitHub ↗

分析执行函数 :param params: :return:

(self, params)

Source from the content-addressed store, hash-verified

96 return True
97
98 def analyze(self, params):
99 """
100 分析执行函数
101 :param params:
102 :return:
103 """
104 source_dir = params.source_dir
105 work_dir = os.getcwd()
106 lang = params.lang
107 envs = params.get("envs", {})
108 rules = params.get("rules", None)
109 infer_result_dir = os.path.join(work_dir, "infer_result")
110 error_output = os.path.join(infer_result_dir, "report.json")
111 build_cwd = os.environ.get("BUILD_CWD", None)
112 compile_cwd = os.path.join(source_dir, build_cwd) if build_cwd else source_dir
113
114 scan_analyze_cmd = [
115 "infer",
116 "analyze",
117 "--print-active-checkers",
118 "--ml-buckets",
119 "all",
120 "--no-default-checkers",
121 ]
122 # 全量规则
123 # 根据lang加载对应语言的checker
124 if lang == "java":
125 scan_analyze_cmd += [
126 "--annotation-reachability",
127 "--check-nullable",
128 "--biabduction",
129 "--bufferoverrun",
130 "--eradicate",
131 "--fragment-retains-view",
132 "--immutable-cast",
133 "--printf-args",
134 "--suggest-nullable",
135 "--quandary",
136 "--racerd",
137 "--litho",
138 "--cost",
139 "--starvation",
140 "--dump-duplicate-symbols",
141 ]
142 else:
143 # oc、C/C++
144 scan_analyze_cmd += [
145 "--check-nullable",
146 "--biabduction",
147 "--bufferoverrun",
148 "--liveness",
149 "--suggest-nullable",
150 "--ownership",
151 "--quandary",
152 "--racerd",
153 "--siof",
154 "--uninit",
155 "--cost",

Callers

nothing calls this directly

Calls 5

print_logMethod · 0.95
_large_json_handleMethod · 0.95
getMethod · 0.45
loadMethod · 0.45
infoMethod · 0.45

Tested by

no test coverage detected