aws-cloudformation / cfn-lint-visual-studio-code

CloudFormation Linter IDE integration, autocompletion, and documentation
https://marketplace.visualstudio.com/items?itemName=kddejong.vscode-cfn-lint
Apache License 2.0
260 stars 154 forks source link

Errors on yaml.validate: true #97

Closed riccardopedrielli closed 2 years ago

riccardopedrielli commented 4 years ago

Environment:

Problem

This extension is setting yaml.validate to false whenever it starts. As I understand this is done because, with the default setting (true), a lot of false errors are shown.

Leaving out that's a bad practice to edit other extension's settings with no user consent/notice, my first question is:

I noticed other closed issues on this topic, but it seems the problem was never resolved. Since I think that we should be able to work with the validation enabled, I want to ask:

kddejong commented 4 years ago

Let me test a few things out. Also note that the Readme needs to be updated to include the setting. https://github.com/aws-cloudformation/aws-cfn-lint-visual-studio-code/blob/befb50db9205316d6940d50cde5d5ffa68486195/package.json#L87-L91 The idea here is to draw visibility to issues with the yaml validation as we are mostly looking to use that extension for the autocomplete capabilities. We tried to wrap the setting with our own setting and only set it if appropriate. I would agree this isn't an ideal solution but we believe the autcomplete functionality is helpful to doing CloudFormation development. What I want to make sure is that we didn't miss a scenario. We should only be setting yaml.validate to false only if you have cfnLint.validateUsingJsonSchema set to false

riccardopedrielli commented 4 years ago

Another problem of writing yaml.validate: false into the settings.json of vs code is also that the validation is disabled for every other yaml file, be it a cfn o just a regular yaml.

PatMyron commented 4 years ago

relevant code: https://github.com/aws-cloudformation/aws-cfn-lint-visual-studio-code/blob/089b197e2c7df4ec26d35c23ebb77383c724a86e/client/src/extension.ts#L188-L209

motdde commented 2 years ago

Hello @kddejong and @PatMyron,

Have you been able to find a solution to this?

I am new to cloud formation. I have spent several hours figuring out why block scalars are flagged as errors in the Yaml files. JSON schema is not identifying values as strings when working with the Intrinsic function.

kddejong commented 2 years ago

I'm working on a new way to include the yaml language server that should resolve these issues. its a bigger rewrite to the plugin but should allow us to completely decouple from the vscode-yaml extension.

kddejong commented 2 years ago

We no longer require vscode-yaml and this should be resolved at this point.

motdde commented 2 years ago

Thanks @kddejong