Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add SARIF support for easier integration with SAST/SCA tools #564 #566

Closed
wants to merge 1 commit into from

Conversation

SimardeepSingh-zsh
Copy link

This Python script is designed to parse SARIF (Static Analysis Results Interchange Format) files. Here’s a step-by-step summary of what the code does:

The parse_sarif function is defined to take a file path as an argument.
The function opens the file in read mode and loads the JSON data.
It extracts the SARIF version (if available) for reference.
It then extracts the ‘runs’ from the data. If no ‘runs’ are found, it returns an empty list.
For each ‘run’, it extracts the ‘results’.
It initializes an empty list, parsed_results, to store the parsed results.
For each ‘result’ in ‘results’, it extracts the ‘ruleId’, ‘message’, and ‘location’ (if available).
It appends each extracted result as a dictionary to parsed_results.
Finally, it returns a dictionary containing the SARIF version and the parsed results.
The example usage at the end of the script demonstrates how to use this function with a SARIF file path, and prints out the parsed data.

This script is useful for projects that need to analyze static analysis results from different tools in a standardized way, as SARIF is a widely adopted standard for representing such results. However, please note that this is a basic implementation and might need to be adapted based on your specific needs and the structure of your SARIF files.

@fguisso
Copy link
Member

fguisso commented Oct 16, 2023

Hello @SimardeepSingh-zsh thanks for your time. Following #564 the idea is to return a SARIF in Husky's output, today Husky is not an API to summarize findings, then we don't need a script to transform SARIF into another thing.

Since your PR doesn't add new features or fix bugs in our code, I will close it.

If you want some help to contribute more, please reach us in the Community Discussions

@fguisso fguisso closed this Oct 16, 2023
@marcelometal marcelometal added the invalid invalid label Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid invalid
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants