Skip to content

fix(E1700): stop rejecting rule names CloudFormation accepts - #4924

Merged
kddejong merged 2 commits into
aws-cloudformation:mainfrom
pcbeingused333:fix/e1700-rule-names
Oct 30, 2026
Merged

kddejong merged 2 commits into
aws-cloudformation:mainfrom
pcbeingused333:fix/e1700-rule-names

Conversation

@pcbeingused333

Copy link
Copy Markdown
Contributor

Issue #, if available: Fixes #4837

Description of changes:

E1700 validated the Rules section against src/cfnlint/data/schemas/other/rules/configuration.json, which allowed rule logical names only through the key pattern ^[A-Za-z0-9]+$ with additionalProperties: false. A rule named Env_Check or Env-Check was reported as does not match any of the regexes, although CloudFormation creates the stack and the rule assertions pass (the issue reports CREATE_COMPLETE in us-east-1).

The key restriction is dropped and every value is validated against the rule definition through additionalProperties, the same approach used for condition names in #4787. The value checks are unchanged: a rule without Assertions, or with a non-object value, still reports an error.

Tests: test/unit/rules/rules/test_configuration.py has a new case with Env_Check, Env-Check and Env.Check, and the two existing cases use the new schema path. They fail with the previous schema and pass with the change. cfn-lint on the template from the issue no longer reports E1700, and test/unit passes apart from tests that need optional dependencies not installed in the test environment.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

This change was prepared with Claude Code (AI-assisted); the tests above were run.

🤖 Generated with Claude Code

pcbeingused333 and others added 2 commits October 30, 2026 16:18
The Rules section schema restricted rule logical IDs to ^[A-Za-z0-9]+$ with
additionalProperties false, so names such as Env_Check or Env-Check were
reported even though CloudFormation creates the stack. Validate every value
against the rule definition instead of restricting the key, as was done for
condition names in E8001.

Fixes aws-cloudformation#4837

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Dropping patternProperties from the Rules schema also dropped the only
place add_cfn_lint_keyword was re-enabled, so nested dispatch stayed off
and every intrinsic-function check inside Rules went silent.

Register an additionalProperties override alongside the patternProperties
one and delegate to the stock keyword, restoring E1020, E1701, E8003 and
W8003 inside the Rules section.
@kddejong
kddejong force-pushed the fix/e1700-rule-names branch from 396abad to 368d0db Compare October 30, 2026 23:18
@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.74%. Comparing base (f1ad649) to head (368d0db).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4924   +/-   ##
=======================================
  Coverage   94.73%   94.74%           
=======================================
  Files         442      442           
  Lines       16102    16105    +3     
  Branches     3125     3125           
=======================================
+ Hits        15255    15258    +3     
- Misses        467      468    +1     
+ Partials      380      379    -1     
Flag Coverage Δ
unittests 94.73% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kddejong
kddejong merged commit 6edc830 into aws-cloudformation:main Oct 30, 2026
25 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.

E1700: Rules names containing _ or - are rejected, but CloudFormation accepts them

2 participants