Skip to content

Commit 95bd4b2

Browse files
authored
store sarif tool data (#943)
* store sarif tool data * apparently we do need init
1 parent a91d084 commit 95bd4b2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/codemodder/result.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,16 +178,22 @@ def fuzzy_column_match(pos: CodeRange, location: Location) -> bool:
178178

179179
class ResultSet(dict[str, dict[Path, list[Result]]]):
180180
results_for_rule: dict[str, list[Result]]
181+
# stores SARIF runs.tool data
182+
tools: list[dict[str, dict]]
181183

182184
def __init__(self, *args, **kwargs):
183185
super().__init__(*args, **kwargs)
184186
self.results_for_rule = {}
187+
self.tools = []
185188

186189
def add_result(self, result: Result):
187190
self.results_for_rule.setdefault(result.rule_id, []).append(result)
188191
for loc in result.locations:
189192
self.setdefault(result.rule_id, {}).setdefault(loc.file, []).append(result)
190193

194+
def store_tool_data(self, tool_data: dict):
195+
self.tools.append(tool_data)
196+
191197
def results_for_rule_and_file(
192198
self, context: CodemodExecutionContext, rule_id: str, file: Path
193199
) -> list[Result]:

0 commit comments

Comments
 (0)