Warning not ignored with pre-commit hook
See original GitHub issuecfn-lint version: 0.25 Python: 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)] on win32 pre-commit: 1.17.0 Description of issue.
I have below in my .pre-commit-config.yaml
in my git repository
repos:
- repo: https://github.com/awslabs/cfn-python-lint
rev: v0.25.0 # The version of cfn-lint to use
hooks:
- id: cfn-python-lint
name: AWS CloudFormation Linter
files: cfn_templates/.*\.(yml|yaml)$
When I run pre-commit, I got a warning:
AWS CloudFormation Linter................................................Failed
hookid: cfn-python-lint
W1020 Fn::Sub isn't needed because there are no variables at Resources/KafkaLaunchConfig/Metadata/AWS::CloudFormation::Init/configureKafka/files//opt/kafka/bin/kafka-start.sh/content/Fn::Sub
cfn_templates/kafka_kafkacluster.yaml:244:29
I have already put this section in my cloudformation template:
Metadata:
cfn-lint:
config:
regions:
- eu-central-1
ignore_checks:
- W1020
But I still get the warning. When I run cfn-lint standaone to validate this template, then the warning will not be displayed.
How can I get the validation work with pre-commit? Is there a way to specify ignore checks in .pre-commit-config.yaml
?
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Warning not ignored with pre-commit hook #1196 - GitHub
When I run cfn-lint standaone to validate this template, then the warning will not be displayed. How can I get the validation work...
Read more >Why is my Git pre-commit hook not executable by default?
hint: The 'pre-commit' hook was ignored because it's not set as executable. hint: You can disable this warning with `git config advice.
Read more >Supported hooks - pre-commit
check-docstring-first - checks a common error of defining a docstring after code. check-executables-have-shebangs - ensures that (non-binary) executables have ...
Read more >Pre-commit Hook - Prettier
You can use Prettier with a pre-commit tool. This can re-format your files that are marked as “staged” via `git add` before you...
Read more >pre-commit-hooks - PyPI
Note that no-commit-to-branch is configured by default to always_run . As a result, it will ignore any setting of files , exclude ,...
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
I’m having troubles replicating this. This template will appropriately skip error W1020 for me. How many other yaml/yml/json files do you have in that repo?
Our entry point is the same as the command line. https://github.com/aws-cloudformation/cfn-python-lint/blob/master/.pre-commit-hooks.yaml#L3
I am also having trouble replicating this issue on win32 . Multiple versions of cfn-lint attempted from v0.25.0 in the original report to quite a few versions afterwards, including v0.69.1
Removing the Metadata from the provided kafka_cluster.yaml causes the run to fail but including that part it passes precommit with cfn-lint.
What is your pre-commit-config.yaml and cfn template like @skshahidur ?