From 4cefa920d85c8cbdf97878871a76fc9ec95e6f9a Mon Sep 17 00:00:00 2001 From: Nikita Pivkin Date: Mon, 22 Jan 2024 18:25:12 +0700 Subject: [PATCH] refactor: simplify result functions --- lib/result/result.rego | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/lib/result/result.rego b/lib/result/result.rego index 9ab6cce8..ccf78bca 100644 --- a/lib/result/result.rego +++ b/lib/result/result.rego @@ -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)