Skip to content

Commit b7d476d

Browse files
committed
Bug fix for SARIF file creation
1 parent ff4f386 commit b7d476d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

scrub/tools/parsers/translate_results.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ def format_sarif_for_upload(input_file, output_file, source_root, upload_format)
233233

234234
# Initialize variables
235235
formatted_results = []
236+
tool_name = input_file.stem
236237

237238
# Import the SARIF results
238239
unformatted_results = parse_sarif(input_file, source_root)
@@ -248,15 +249,15 @@ def format_sarif_for_upload(input_file, output_file, source_root, upload_format)
248249
warning['description'] = [warning['description'][0]]
249250
formatted_results.append(warning)
250251

251-
create_sarif_output_file(formatted_results, '2.1.0', output_file, source_root)
252+
create_sarif_output_file(formatted_results, '2.1.0', output_file, source_root, tool_name)
252253
elif upload_format == 'codesonar':
253254
# shutil.copyfile(input_file, output_file)
254255
for warning in unformatted_results:
255256
# Add a prefix to the tool name to allow for filtering
256257
warning['tool'] = 'external-' + warning['tool']
257258
warning['query'] = warning['tool'].title() + ' ' + warning['query']
258259
formatted_results.append(warning)
259-
create_sarif_output_file(formatted_results, '2.1.0', output_file, source_root)
260+
create_sarif_output_file(formatted_results, '2.1.0', output_file, source_root, tool_name)
260261

261262

262263
def parse_sarif(sarif_filename, source_root):

0 commit comments

Comments
 (0)