Skip to content

Commit 0bd16cb

Browse files
committed
clean up compliant/skipped rules handling
1 parent c42a1a9 commit 0bd16cb

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/rpdk/guard_rail/core/runner.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,17 @@
4848
def filter_results_for_read_only(result: GuardRuleSetResult) -> GuardRuleSetResult:
4949
"""Filter execution results to only include read-only checks.
5050
51+
Only filters non_compliant and warning results by check ID since compliant
52+
and skipped results don't contain check IDs (just rule names).
53+
5154
Args:
5255
result: The full execution result
5356
5457
Returns:
5558
Filtered result containing only read-only checks
5659
"""
57-
filtered_compliant = []
5860
filtered_non_compliant = {}
5961
filtered_warning = {}
60-
filtered_skipped = []
61-
62-
# Filter compliant rules (we don't have check IDs, so keep all)
63-
filtered_compliant = result.compliant
6462

6563
# Filter non-compliant results by check ID
6664
for rule_name, rule_results in result.non_compliant.items():
@@ -78,14 +76,13 @@ def filter_results_for_read_only(result: GuardRuleSetResult) -> GuardRuleSetResu
7876
if filtered_rule_results:
7977
filtered_warning[rule_name] = filtered_rule_results
8078

81-
# Keep skipped rules (we don't have check IDs, so keep all)
82-
filtered_skipped = result.skipped
83-
79+
# Keep all compliant and skipped rules since they don't have check IDs
80+
# and don't represent failures that would block read-only resources
8481
return GuardRuleSetResult(
85-
compliant=filtered_compliant,
82+
compliant=result.compliant,
8683
non_compliant=filtered_non_compliant,
8784
warning=filtered_warning,
88-
skipped=filtered_skipped,
85+
skipped=result.skipped,
8986
schema_difference=result.schema_difference,
9087
)
9188

0 commit comments

Comments
 (0)