-
Notifications
You must be signed in to change notification settings - Fork 13
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
Semgrep pre-commit hook #241
base: main
Are you sure you want to change the base?
Conversation
|
Co-authored-by: Dániel Kántor <[email protected]>
5a760b4
to
b4a51d2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few small nits, but approving in case they aren't needed.
import future.keywords.if | ||
import future.keywords.every |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think import rego.v1
brings you both of these.
import future.keywords.if | |
import future.keywords.every | |
import rego.v1 |
semgrep_hooks[hook_id].id == "semgrep" | ||
} | ||
|
||
message := "" if allow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe message is only used when allow
is false, so you can just do:
message := "" if allow | |
message := "Semgrep pre-commit hook is not configured for the repository" |
repo_data := parsed_data.repos[repo_id] | ||
endswith(repo_data["repo"], "https://github.com/semgrep/pre-commit") | ||
semgrep_hooks = repo_data["hooks"] | ||
semgrep_hooks[hook_id].id == "semgrep" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like Semgrep has 4 configurations: semgrep
, semgrep-ci
, semgrep-docker
, and semgrep-docker-develop
. It looks like this requires the semgrep
one and not (for example) the CI one. Is this usage intentional?
No description provided.