Skip to content

Commit

Permalink
refactor: simplify result functions
Browse files Browse the repository at this point in the history
  • Loading branch information
nikpivkin committed Jan 22, 2024
1 parent 4586d05 commit 4cefa92
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions lib/result/result.rego
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,11 @@
# library: true
package lib.result

new(message, metadata) = result {
result := {
"metadata": metadata,
"msg": message,
}
new(message, metadata) := {
"metadata": metadata,
"msg": message,
}

is_managed(cause) = res {
metadata := get_metadata(cause)
res := metadata.managed
}
is_managed(cause) := get_metadata(cause).managed

get_metadata(cause) = metadata {
metadata := object.get(cause, "__defsec_metadata", cause)
}
get_metadata(cause) := object.get(cause, "__defsec_metadata", cause)

0 comments on commit 4cefa92

Please sign in to comment.