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

Limit Linter to Specific Files or Patterns #68

Open
sgtoj opened this issue Oct 31, 2019 · 9 comments
Open

Limit Linter to Specific Files or Patterns #68

sgtoj opened this issue Oct 31, 2019 · 9 comments

Comments

@sgtoj
Copy link

sgtoj commented Oct 31, 2019

Can a setting be added to use cfn-lint extension to lint specific GLOB patterns? I would like to set yaml.validate VS Code setting to enable for non-CloudFormation templates.

@kddejong
Copy link
Contributor

I think the appropriate thing to do here, for now. Is to allow a person to configure if the YAML completion is enabled or disabled.

I'm trying to figure out a clever way to enable/disable as needed but it may be messy.

@coyoteecd
Copy link

It would be useful to exclude specific patterns as well. In my case, I use Serverless Framework to do deploys, and rely on this VSCode plugin + cfn-python-lint to do validation of the yml resources. This works reasonably well, except that the plugin tries to be smart and runs linting on the autogenerated .serverless/*.json files, which contains a json file that's not a CloudFormation template but seems to be picked as such.

A simple way to ignore a path via e.g. plugin settings would be great for my use case.
A better way is for the plugin to take into account the .cfnlintrc that I have defined in the workspace root, in the same way as the cfn-lint command does when I run it there. This also addresses the use case mentioned in the top comment.

Thoughts?

@sodaru-it
Copy link

+1

@r0zar
Copy link

r0zar commented May 22, 2021

Just ran into this issue today as well working with serverless-state.json files

@dead-claudia
Copy link

I ran into this today with it picking up my local package.json (an exceptionally common Node config file - I shouldn't need to explain its significance), and its attempt to format the file ended up breaking it.

I decided to simply disable format on paste for JSON files specifically, as this isn't the only formatter that's given me grief with files of that format.

@PatMyron
Copy link
Contributor

PatMyron commented Sep 6, 2022

@dead-claudia as far as I'm aware, the cfn-lint extension does not currently format any files, any chance another extension is causing that formatting on paste?

@kddejong
Copy link
Contributor

kddejong commented Sep 6, 2022

@sgtoj the current version of the plugin will only validate against CloudFormation templates. It no longer overrides the settings of redhat.vscode-yaml

@dead-claudia I will look into it. You can set cfnLint.format.enable so it doesn't format.

@dead-claudia
Copy link

@kddejong I normally use YAML exclusively for CFN configs anyways, so it wasn't all that painful to just disable.

@PatMyron Nothing else shows up in my list of JSON formatters when I ran "Format document with...", and it's extremely unlikely this is being caused by any other extension.

@kddejong
Copy link
Contributor

kddejong commented Sep 6, 2022

Looking into better logic on the formatting functionality now.

Agreed let me see what it would look like to add some file pattern matching

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

7 participants