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

Method analyze

client/tool/spotbugs.py:50–79  ·  view source on GitHub ↗
(self, params)

Source from the content-addressed store, hash-verified

48 return True
49
50 def analyze(self, params):
51
52 source_dir = params["source_dir"]
53 enabled_rules = params["rules"]
54 error_output = os.path.join(os.path.curdir, "spotbugs_result.xml")
55
56 # analyze step
57 tool_name = "spotbugs"
58 visitors = RulesToVisitors(tool_name).get_needed_visitors(enabled_rules)
59 scan_cmd = [
60 "java",
61 "-jar",
62 os.path.join(os.environ["SPOTBUGS_HOME"], "lib", "spotbugs.jar"),
63 "-textui",
64 "-low",
65 "-exitcode",
66 "-nested:false",
67 "-xml:withMessages",
68 ]
69 if visitors:
70 scan_cmd.append("-visitors")
71 scan_cmd.append(",".join(visitors))
72 scan_cmd.extend(["-output", error_output, source_dir])
73 self.print_log(" ".join(scan_cmd))
74 SubProcController(scan_cmd).wait()
75
76 # format step
77 ctf = ClassToFilename(source_dir)
78 items = Findbugs.data_handle(error_output, enabled_rules, ctf)
79 return items
80
81
82tool = Spotbugs

Callers

nothing calls this directly

Calls 5

RulesToVisitorsClass · 0.90
ClassToFilenameClass · 0.90
get_needed_visitorsMethod · 0.80
print_logMethod · 0.45
data_handleMethod · 0.45

Tested by

no test coverage detected