# Lint YAML

**URL:** <https://forums.powershell.org/t/lint-yaml/12067>\
**Category:** PowerShell Help\
**Created:** [February 25, 2019, 7:13am UTC](https://forums.powershell.org/t/lint-yaml/12067 "2019-02-25T07:13:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonv](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/jonv/32/242_2.png) [@jonv](https://forums.powershell.org/u/jonv)\
**Post date:** [February 25, 2019, 7:13am UTC](https://forums.powershell.org/t/lint-yaml/12067/1 "2019-02-25T07:13:21Z")

</div>

As part of our build process we have some YAML files, I would like to validate these files and ideally Lint them.

&nbsp;

What would be the best way to go about this please ?

---

<div class="post-metadata">

**Author:** ![postanote](https://avatars.discourse-cdn.com/v4/letter/p/ebca7d/32.png) [@postanote](https://forums.powershell.org/u/postanote)\
**Post date:** [February 25, 2019, 2:37pm UTC](https://forums.powershell.org/t/lint-yaml/12067/2 "2019-02-25T14:37:31Z")

</div>

There are no _lint_ cmdlets that are native to PowerShell.

You’d have to leverage C/C++ to get such things and use PowerShell Add-Type cmdlet to bring such DLL’s in to your script for use.  
I personally don’t use YAML, so, I’ve had no reason to look at it to date or look up any API / DLL needed to interact with it.

There are request in the PowerShell GitHub to have cmdlets for YAML, but that is not linting.

> ConvertFrom-Yaml, ConvertTo-Yaml https://github.com/PowerShell/PowerShell/issues/3607

However, a quick web search for ‘powershell yaml lint’ turns up several hits you can leverage.

Example:

> YAML in powershell powershell doesn't have native support for yaml. Solution: PSYAML and powershell-yaml http://dbadailystuff.com/yaml-in-powershell
> 
> PSYaml: PowerShell does YAML - Simple Talk
> 
> > **[PSYaml: PowerShell does YAML - Simple Talk](https://www.red-gate.com/simple-talk/blogs/psyaml-powershell-yaml/)**
> >
> > PSYaml is a simple PowerShell module that I’ve written that allows you to serialize PowerShell objects to "YAML Ain’t Markup Language" (YAML) documents
> 
> GitHub - cloudbase/powershell-yaml: PowerShell CmdLets for
> 
> > **[GitHub - cloudbase/powershell-yaml: PowerShell CmdLets for YAML format...](https://github.com/cloudbase/powershell-yaml)**
> >
> > PowerShell CmdLets for YAML format manipulation. Contribute to cloudbase/powershell-yaml development by creating an account on GitHub.
> 
> on GitHub: [GitHub - scottmuc/PowerYaml: Powershell wrapper for Yaml.Net](https://github.com/scottmuc/PowerYaml)  
> …which is a wrapper for the YamlDotNet library: [GitHub - aaubry/YamlDotNet: YamlDotNet is a .NET library for YAML](https://github.com/aaubry/YamlDotNet)
> 
> uses in YAML in PSDeploy
> 
> > **[PSDeploy: Simplified PowerShell Based Deployments](http://ramblingcookiemonster.github.io/PSDeploy/)**
> >
> > More abstraction

There are Linter if you are using VSCode as your editor. It’s part of the extension library, but none are PS specific.

---

<div class="post-metadata">

**Author:** ![kvprasoon](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/kvprasoon/32/4449_2.png) [@kvprasoon](https://forums.powershell.org/u/kvprasoon)\
**Post date:** [February 25, 2019, 9:15pm UTC](https://forums.powershell.org/t/lint-yaml/12067/3 "2019-02-25T21:15:30Z")

</div>

you can use [yamllint](https://github.com/adrienverge/yamllint) , but it has no relation with PowerShell and cannot run on windows by default. As @postanote mentioned, VSCode yamllint plug-in is the best way to achieve this in Windows.

---

<div class="post-metadata">

**Author:** ![jonv](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/jonv/32/242_2.png) [@jonv](https://forums.powershell.org/u/jonv)\
**Post date:** [March 4, 2019, 10:42am UTC](https://forums.powershell.org/t/lint-yaml/12067/4 "2019-03-04T10:42:22Z")

</div>

Thanks for the replies. I was hoping I had over looked an obvious YAML Linter that I could implement into our build process. This doesn’t look to be the case.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:33pm UTC](https://forums.powershell.org/t/lint-yaml/12067/5 "2024-05-16T20:33:12Z")

</div>

Closed on May 16, 2024, 8:33pm UTC


