Skip to content

Commit

Permalink
Bug fix for SARIF file creation
Browse files Browse the repository at this point in the history
  • Loading branch information
lylebarner committed Feb 10, 2025
1 parent ff4f386 commit b7d476d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scrub/tools/parsers/translate_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ def format_sarif_for_upload(input_file, output_file, source_root, upload_format)

# Initialize variables
formatted_results = []
tool_name = input_file.stem

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

create_sarif_output_file(formatted_results, '2.1.0', output_file, source_root)
create_sarif_output_file(formatted_results, '2.1.0', output_file, source_root, tool_name)
elif upload_format == 'codesonar':
# shutil.copyfile(input_file, output_file)
for warning in unformatted_results:
# Add a prefix to the tool name to allow for filtering
warning['tool'] = 'external-' + warning['tool']
warning['query'] = warning['tool'].title() + ' ' + warning['query']
formatted_results.append(warning)
create_sarif_output_file(formatted_results, '2.1.0', output_file, source_root)
create_sarif_output_file(formatted_results, '2.1.0', output_file, source_root, tool_name)


def parse_sarif(sarif_filename, source_root):
Expand Down

0 comments on commit b7d476d

Please sign in to comment.