Support SAM templates
glnds opened this issue · comments
You can run :CocInfo inside vim to see the coc-cfn-lint logs and you'll see whether your file is being detected as CloudFormation. It currently doesn't do this check by looking at filename. Instead, it looks at file contents. By default, it will detect the file as CloudFormation if it contains both "AWSTemplateFormatVersion" and "Resources". In my case, I'm working with non-standard template files that don't always contain both these lines, so I have set the cfnlint.detectCfnRegExps as follows:
"cfnlint.detectCfnRegExps": ["AWS::", "\n?"Resources"?\s*:"],
cfn-lint works out of the box on SAM templates as well. I would suggest to scan for both AWSTemplateFormatVersion and Transform: AWS::Serverless*
Just my 2 cents
Since AWSTemplateFormatVersion
is optional, the CloudFormation Linter Visual Studio Code extension has more extensive CloudFormation template recognition logic in TypeScript that can be borrowed
Similar discussions: aws-cloudformation/cfn-lint-visual-studio-code#99, aws/aws-toolkit-jetbrains#1715 (comment), https://github.com/github/super-linter/pull/231#discussion_r445708695, mwpearce/vscode-cfn-nag#6