ignore_templates is not working from .cfnlintrc file
See original GitHub issue*cfn-lint version: 0.21.0
Description of issue.
- ignore_templates is not working from .cfnlintrc file. Used .cfnlintrc file to ignore templates , but it is not working . It throws below error
AWS CloudFormation Linter................................................Failed
hookid: cfn-python-lint
usage: cfn-lint [-h] [-t TEMPLATE [TEMPLATE ...]] [-b]
[--ignore-templates IGNORE_TEMPLATES [IGNORE_TEMPLATES ...]]
[-d] [-f {quiet,parseable,json}] [-l]
[-r REGIONS [REGIONS ...]]
[-a APPEND_RULES [APPEND_RULES ...]]
[-i IGNORE_CHECKS [IGNORE_CHECKS ...]]
[-c INCLUDE_CHECKS [INCLUDE_CHECKS ...]] [-e]
[-x CONFIGURE_RULES [CONFIGURE_RULES ...]] [-o OVERRIDE_SPEC]
[-v] [-u]
[TEMPLATE [TEMPLATE ...]]
CloudFormation Linter
optional arguments:
-h, --help show this help message and exit
Standard:
TEMPLATE The CloudFormation template to be linted
-t TEMPLATE [TEMPLATE ...], --template TEMPLATE [TEMPLATE ...]
The CloudFormation template to be linted
-b, --ignore-bad-template
Ignore failures with Bad template
--ignore-templates IGNORE_TEMPLATES [IGNORE_TEMPLATES ...]
Ignore templates
-f {quiet,parseable,json}, --format {quiet,parseable,json}
Output Format
-l, --list-rules list all the rules
-r REGIONS [REGIONS ...], --regions REGIONS [REGIONS ...]
list the regions to validate against.
-i IGNORE_CHECKS [IGNORE_CHECKS ...], --ignore-checks IGNORE_CHECKS [IGNORE_CHECKS ...]
only check rules whose id do not match these values
-c INCLUDE_CHECKS [INCLUDE_CHECKS ...], --include-checks INCLUDE_CHECKS [INCLUDE_CHECKS ...]
include rules whose id match these values
-e, --include-experimental
Include experimental rules
-x CONFIGURE_RULES [CONFIGURE_RULES ...], --configure-rule CONFIGURE_RULES [CONFIGURE_RULES ...]
Provide configuration for a rule. Format
RuleId:key=value. Example: E3012:strict=false
-v, --version Version of cfn-lint
Advanced / Debugging:
-d, --debug Enable debug logging
-a APPEND_RULES [APPEND_RULES ...], --append-rules APPEND_RULES [APPEND_RULES ...]
specify one or more rules directories using one or
more --append-rules arguments.
-o OVERRIDE_SPEC, --override-spec OVERRIDE_SPEC
A CloudFormation Spec override file that allows
customization
-u, --update-specs Update the CloudFormation Specs
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
ignore_templates is not working from .cfnlintrc file #987 - GitHub
cfnlintrc file. Used .cfnlintrc file to ignore templates , but it is not working . It throws below error. AWS CloudFormation Linter....
Read more >CloudFormation Linter configuration - Codeac
CloudFormation Linter requires configuration via a .cfnlintrc configuration file as detailed in CloudFormation Linter's documentation.
Read more >CFN Lint: AWS CloudFormation Linter - Morioh
AWS CloudFormation Linter, Validate AWS CloudFormation yaml/json templates against the AWS CloudFormation Resource Specification and additional checks.
Read more >cfn-lint Changelog - pyup.io
Complete redo how we handle arguments to fix issues created when linting multiple files with cfn-lint configurations in the file
Read more >cfn-lint - MegaLinter by OX Security
Version in MegaLinter: 0.72.0 · Visit Official Web Site. If custom .cfnlintrc.yml config file is not found, .cfnlintrc.yml will be used · See...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Below is the .cfnlintrc file from my repo
Below is the .pre-commit-config.yaml file from my repo
Below is the link of my repo for your reference https://github.com/karthickcse05/cfnlint-testing.git
Note:
@chuckmeyer thoughts on this?
I think the issue here is that pre-commit must exist cfn-lint with each filename that has changed that meets the pattern. However, if
.cfnlintrc
says to ignoreSolutions/SNSFlow/parameters-test.json
it gets filtered out from the and basically makes the file list empty. I believe that is why we throw a usage error. I’m not sure what the correct type of failure (or success) is here.@KarthickEmis I wonder if in the short term you should add the exclude patterns to the pre commit hook so that it gets filtered out before .cfnlintrc is even used.