Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to work with .template #28

Open
lesley-tw opened this issue Nov 8, 2018 · 6 comments
Open

How to work with .template #28

lesley-tw opened this issue Nov 8, 2018 · 6 comments

Comments

@lesley-tw
Copy link

I have several *.template file, and all file begin with AWSTemplateFormatVersion: '2010-09-09' at first line, but I cannot get any lint on the file.

When I click other *.yml file, it will output Don't believe this is a CloudFormation template., it correct, because it really not a cloudformation template, but when I click the cloudformation template *.template file, it doesn't have any output messages.

Anyone could help? Should I modify any config?

@kddejong
Copy link
Contributor

kddejong commented Nov 8, 2018

We do look for yaml and json files. From there we try to determine if they are a CloudFormation template.

Let me test a few things here. I think I can give you a more definitive solution.

@kddejong
Copy link
Contributor

kddejong commented Nov 8, 2018

The quick fix on an individual file is to switch the language of the file.
https://code.visualstudio.com/docs/languages/overview#_changing-the-language-for-the-selected-file

You can more permanently make that change by following this.
https://code.visualstudio.com/docs/languages/overview#_can-i-map-additional-file-extensions-to-a-language

@cmmeyer Not sure how far down this we should go. There is absolutely a contingent of *.template folks. I'm not sure we could more globally enable *.template as a CloudFormation template that we would then lint. I may have to see if there are some easier options for this. These workarounds above should provide a solution until we can discuss this more.

@cmmeyer
Copy link

cmmeyer commented Nov 8, 2018

I certainly have .template files on my laptop as well, but I've always expected I would have to tell my IDE what the actual contents were (YAML/JSON). CloudFormation isn't the only software that uses templates, and I'd hate to muck things up for folks who use ".template" to mean something else.

@lesley-tw
Copy link
Author

@kddejong Thank you for the comment. It can work now.

@rjlohan
Copy link
Contributor

rjlohan commented Nov 28, 2018

Can we just expose the file mappings as a configuration option? Leave the defaults alone but allow overrides?

@kddejong
Copy link
Contributor

@rjlohan possibly. We could change this to *. https://github.com/awslabs/aws-cfn-lint-visual-studio-code/blob/master/package.json#L19-L22

https://github.com/awslabs/aws-cfn-lint-visual-studio-code/blob/master/client/src/extension.ts#L39-L42

I think the problem is the .template doesn't associate with a language (unless someone installed a language plugin). We could add the ability to associate to an extension but I would have to look into this... I'm just not sure off the top of my head. The good thing is cfn-lint doesn't care about json or yaml.

We could better document this fix as well.

"files.associations": {
    "*.template": "yaml"
}

@PatMyron PatMyron changed the title Cannot work with cloudformation template Cannot work with .template Feb 29, 2020
@PatMyron PatMyron changed the title Cannot work with .template How to work with .template Feb 29, 2020
@PatMyron PatMyron pinned this issue Oct 19, 2020
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

No branches or pull requests

4 participants