Skip to content

fix: handle invalid JSON in semgrep parser and add unit tests#1741

Open
vedasingh00-rgb wants to merge 2 commits into
utksh1:mainfrom
vedasingh00-rgb:fix/semgrep-parser-tests
Open

fix: handle invalid JSON in semgrep parser and add unit tests#1741
vedasingh00-rgb wants to merge 2 commits into
utksh1:mainfrom
vedasingh00-rgb:fix/semgrep-parser-tests

Conversation

@vedasingh00-rgb

Copy link
Copy Markdown
Contributor

Description

Fixed the semgrep_scanner parser to handle invalid JSON gracefully instead of silently ignoring errors. Added unit tests to verify all three scenarios — valid JSON, invalid JSON, and mixed stdout output.

Related Issues

#1421

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Added 3 unit tests in testing/test_semgrep_parser.py and ran them using pytest:
test_valid_json — verifies valid Semgrep JSON is parsed correctly
test_invalid_json — verifies invalid JSON does not crash the parser
test_mixed_stdout — verifies mixed stdout is handled gracefully

image

Checklist

  • My code follows the code style of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant