-
Notifications
You must be signed in to change notification settings - Fork 625
Open
Description
CloudFormation Lint Version
v1.42.1
What operating system are you using?
Windows 11
Describe the bug
Summary:
cfn-lint fails in a pre-commit hook when using the flag --non-zero-exit-code, producing the error:
maximum recursion depth exceeded while calling a Python object
Environment
cfn-lint version: tested with v1.42.1 and v1.43.0
Python version: 3.11.9
pre-commit version: 4.5.0
- NOTE: The issue can be reproduced using the information below. I created a new repository specifically to test and confirm the behavior, isolating
cfn-lintfrom other hooks.
pre-commit configuration
repos:
- repo: https://github.com/aws-cloudformation/cfn-lint
rev: v1.42.1
hooks:
- id: cfn-lint-rc
name: cfn-lint · Validate CloudFormation templates.cfnlintrc.yaml
templates:
- templates/**/*.yaml
non_zero_exit_code: error
# ignore_checks:
# - W2001Steps to reproduce
- Install and configure pre-commit in the repository
- Configure
cfn-linthook (code above) and copy.cfnlintrc.yamlto the root folder. - Create a folder named templates and put the reproduction template there.
- In a terminal, run
pre-commit run --all-files
Actual Behavior
$ pre-commit run --all-files
cfn-lint · Validate CloudFormation templates.............................Failed
- hook id: cfn-lint-rc
- exit code: 1
maximum recursion depth exceeded while calling a Python object
When non_zero_exit_code: error is omitted, the process works as intended:
$ pre-commit run --all-files
cfn-lint · Validate CloudFormation templates.............................Failed
- hook id: cfn-lint-rc
- exit code: 4
W2001 Parameter UnusedParameter not used.
templates\test_template.yaml:2:3
When ignore_checks is set, the process also works as intended.
- NOTE: I currently don’t know how to execute
cfn-lintin debug mode inside pre-commit, which is why I’m unable to include a debug log.
Expected behavior
$ pre-commit run --all-files
cfn-lint · Validate CloudFormation templates.............................Passed
Reproduction template
Parameters:
UnusedParameter:
Type: String
Resources:
LogGroup:
Type: AWS::Logs::LogGroupReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels