Skip to content
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

[BugFix]: cfn-guard no longer errors out when rule files are empty, or contain only comments #402

Merged
merged 2 commits into from Aug 29, 2023

Conversation

joshfried-aws
Copy link
Contributor

Issue #, if available:
#376

Description of changes:
Added a check before parsing for the grammar, that discards all leading comments, or empty space, and made the crate::rules::parser::rules_file function now return Result<Option<RulesFile>, Error> instead of Result<RulesFile, Error> calling functions of this now also return the same Result<Option<RulesFile>, E> struct, and functions such as evaluate_rule now return 0 if it receives Ok(None) functions such as the evaluator in our structured_reporter now just skip the step of appending to the list of rules.

Also updated expected results of some test cases, and added a new test case for when using the validate command with a file that contains only comments


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@akshayrane akshayrane self-requested a review August 28, 2023 20:36
@joshfried-aws joshfried-aws changed the title [BugFix}: cfn-guard no longer errors out when rule files are empty, or contain only comments [BugFix]: cfn-guard no longer errors out when rule files are empty, or contain only comments Aug 29, 2023
@joshfried-aws joshfried-aws merged commit aa3dbdf into aws-cloudformation:main Aug 29, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants