diff --git a/scripts/workflow/recategorize_guidelines.sh b/scripts/workflow/recategorize_guidelines.sh index 8fa4b736020..6ec2088f409 100755 --- a/scripts/workflow/recategorize_guidelines.sh +++ b/scripts/workflow/recategorize_guidelines.sh @@ -24,5 +24,27 @@ python3 "$RECATEGORIZE_SCRIPT" \ "$CODING_STANDARDS_CONFIG" \ "$SARIF_FILE" \ "sarif-results-recategorized/$(basename "$SARIF_FILE")" - rm "$SARIF_FILE" - mv "sarif-results-recategorized/$(basename "$SARIF_FILE")" "$SARIF_FILE" +# PY_EXIT=$? +# if [ $PY_EXIT -ne 0 ]; then +# echo "Recategorization failed (exit code $PY_EXIT). SARIF file not updated." >&2 +# exit $PY_EXIT +# fi +rm "$SARIF_FILE" +mv "sarif-results-recategorized/$(basename "$SARIF_FILE")" "$SARIF_FILE" + +# # Ensure jq is available +# if ! command -v jq >/dev/null 2>&1; then +# echo "Error: jq is required but not installed. Please install jq and rerun this script." >&2 +# exit 1 +# fi + +# # Filter SARIF to only include results from repos/* (relative or absolute) +# echo "Filtering SARIF results to only include entries with paths matching (^|/)repos/ ..." +# jq '(.runs) |= map(.results |= map(select((.locations // [] | length > 0) and ((.locations[0].physicalLocation.artifactLocation.uri // "") | test("(^|/)repos/")))) )' "$SARIF_FILE" > "${SARIF_FILE}.filtered" +# if [ $? -eq 0 ]; then +# mv "${SARIF_FILE}.filtered" "$SARIF_FILE" +# else +# echo "jq filtering failed. SARIF file was not modified." >&2 +# rm -f "${SARIF_FILE}.filtered" +# exit 1 +# fi