aws-cloudformation / aws-cloudformation/cloudformation-guard
[Enhancement] Add Support for Arithmetic Operations
- Dominant language
- Rust
- Stars
- 1.4k
- Forks
- 196
- Avg merge
- 3d 6h
- Merged PRs (30d)
- 5
Description
**Is your feature request related to a problem? Please describe.**
I'd like to do some basic math in assertions and counts() outside of the binary comparison operations.
**Describe the solution you'd like**
Be able to parse and validate a rule similar to the following:
```
let minimum_tag_ratio = 0.95
rule tag_ratio_must_be_over_sla {
let all_resources_to_check = Resources.*[ Type == /AWS::IAM::Role/ ]
let found_required_tags = Resources.*[
Type == /AWS::IAM::Role/
Properties.Tags[*].Key == ...blahblah
...blah
]
(count(%found_required_tags) / count(%all_resources_to_check)) >= %minimum_tag_ratio
}
```
Contributor guide
Research direction
The issue names no files, tests, or entry points. Start by locating the parser and rule-evaluation paths for expressions such as count() and binary comparisons, then trace how the example ratio rule is parsed and validated. Done means arithmetic expressions, including division and comparison with a variable, are supported with test coverage for the example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100