Repository navigation
Conversation
6893558 to
3dcdaa0
Compare
|
Thanks for the approval. The post-approval CI failure was a real regression from this change, now fixed: Fixed in 5c20c1a: both fixtures now carry a minimal resource (an S3 bucket in the JSON decode fixture; a |
|
Thanks again for the approval. The fix for the post-approval CI failure is pushed (5c20c1a), but the two fresh workflow runs ([CI] Test PR and [CI] Test PR Data) are parked at "action_required", so CI has not executed on the new head yet. Could you approve the workflow runs when convenient? |
The base template schema required the Resources key but placed no lower
bound on its contents, so a template with `Resources: {}` passed E1001
with exit 0 even though CloudFormation rejects it. Add minProperties: 1
to the Resources property so the empty section is flagged by E1001, the
same rule that reports a missing Resources key.
Add a minimal resource to the empty-Resources fixtures so they lint clean under the new rule: a LogGroup-free Lambda::Permission in metdata.yaml (low-value type per I4010, no partition literals per I3042) and an S3 bucket in the JSON decode fixture. Signed-off-by: Varshith Puli <pulivarshit@gmail.com>
5c20c1a to
008f3ec
Compare
Add newline at the end of parsing.json
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4781 +/- ##
==========================================
- Coverage 94.72% 94.68% -0.04%
==========================================
Files 439 439
Lines 15908 15908
Branches 3079 3079
==========================================
- Hits 15069 15063 -6
- Misses 458 463 +5
- Partials 381 382 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Issue #, if available: #4771
Description of changes:
Problem: A template with
Resources: {}passes cfn-lint with exit 0, while CloudFormationValidateTemplaterejects it. E1001 already flags a missingResourceskey, so the empty section was a false negative in the same rule.Root cause: The base template schema (
src/cfnlint/data/schemas/other/template/configuration.json) declares"required": ["Resources"]but gives theResourcesproperty an unconstrained{}schema. Likewise, the Resources section schema used by E3001 (src/cfnlint/data/schemas/other/resources/configuration.json) caps atmaxProperties: 500but sets no lower bound. Neither schema rejects an empty object.Fix: Add
"minProperties": 1to theResourcesproperty in the base template schema. This makes E1001 fire onResources: {}, consistent with the existing E1001 finding for a missingResourceskey. The keyword is not mapped in E1001'srule_set, so the error is attributed to E1001 itself, matching howrequiredandadditionalPropertiesviolations are reported. Only E1001 consumes this schema, so the blast radius is limited to templates with an emptyResourcessection (which CloudFormation rejects anyway).Verification:
cfn-linton a template withResources: {}exited 0 with no findings.E1001 expected minimum property count: 1, found: 0at theResourceskey and exits 2. A template missingResourcesstill reports'Resources' is a required property, and a valid template with a resource still passes clean.test_base_template.pycounts (base.yaml 1 to 2, base_date.yaml 1 to 2, base_null.yaml 2 to 3) andtest_json_schema.pyexpectations for the new error; added atest_empty_resourcesregression test. Full unit rule suite: 1943 passed. The module suite failures (missingdefusedxml, network dependent graph/pricing tests) are pre-existing environment issues, verified identical on the pristine tree. Integrationtest_good_templatespasses.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.