MCPcopy Create free account
hub / github.com/SourceCode-AI/aura / output

Method output

aura/output/sarif.py:22–95  ·  view source on GitHub ↗
(self, hits, scan_metadata: dict)

Source from the content-addressed store, hash-verified

20 return "sarif"
21
22 def output(self, hits, scan_metadata: dict):
23 tpl = {
24 "version": "2.1.0",
25 "$schema": "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.4.json",
26 "runs": []
27 }
28
29 locations = {}
30
31 run = {
32 "tool": {
33 "driver": {
34 "name": "Aura framework",
35 "version": __version__
36 }
37 },
38 "results": [],
39 "artifacts": []
40 }
41
42 for detection in hits:
43 uri = detection.scan_location.location.as_uri()
44
45 if uri not in locations:
46 artifact = self._convert_to_artifact(detection)
47 locations[uri] = artifact
48
49 d = detection._asdict()
50 level = d["severity"]
51 level = LEVEL_MAP.get(level, level)
52
53 region = {}
54
55 if "line_no" in d:
56 region["startLine"] = d["line_no"]
57 region["endLine"] = d.get("end_line_no", d["line_no"])
58
59 if "col" in d:
60 region["startColumn"] = d["col"]
61
62 if "end_col" in d:
63 region["endColumn"] = d["end_col"]
64
65 if "line" in d:
66 region["snippet"] = {"text": d["line"]}
67 if "endColumn" not in region:
68 region["endColumn"] = len(d["line"])
69
70 result = {
71 "ruleId": d["type"],
72 "level": level,
73 "message": {
74 "text": d["message"]
75 },
76 "locations": [
77 {
78 "physicalLocation": {
79 "artifactLocation": {

Callers 1

scan_uriFunction · 0.45

Calls 3

_convert_to_artifactMethod · 0.95
_asdictMethod · 0.80
getMethod · 0.80

Tested by

no test coverage detected