semgrep icon indicating copy to clipboard operation
semgrep copied to clipboard

Display warnings, but set exit code only on errors?

Open dpc opened this issue 9 months ago • 0 comments

Is your feature request related to a problem? Please describe.

In our git pre-commit hook I'd like to have semgrep remind devs about something that will become a hard error in the future, so they have some time to fix it , but not fail the git hook yet.

No matter which of --strict or --error I use, any rule severity: INFO, WARNING, ERROR, seems to cause non-zero error code.

Describe the solution you'd like

--error=error or something? Just some way to have lower severity levels not cause the command to fail.

Describe alternatives you've considered

I possibly could run semgrep twice with different --severity? But it's a git precommit, and semgrep is already taking significant time there, so that's no ideal.

Use case

Gracefully phasing in new rules without requiring all of the existing violation to block everything.

Additional context NA

dpc avatar Mar 09 '25 01:03 dpc