# YamlLinter

Checks YAML text against a configurable rule set modelled on yamllint (YamlLintRules) and repairs what can be repaired without changing a value.

Class 

`OfficeIMO.Yaml`

**Namespace**

`OfficeIMO.Yaml`

**Assembly**

`OfficeIMO.Yaml`

**Source revision**

`ba882f6b0d07` with working tree changes

**Source**

[YamlLinter.cs:21](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Yaml/Lint/YamlLinter.cs#L21)

**Modifiers**

static

Checks YAML text against a configurable rule set modelled on yamllint ([YamlLintRules](/api/yaml/officeimo-yaml-yamllintrules/)) and repairs what can be repaired without changing a value.

## Inheritance

- object
- YamlLinter

## Remarks

Linting never changes the text. Rules that read the structure (indentation, booleans, keys, quoting) need text that loads; when it does not, the result holds a [YamlLintRules.Syntax](/api/yaml/officeimo-yaml-yamllintrules/) error and the line rules, without fixes.

Filter members 

Show inherited

## Methods

`public static YamlLintFixResult Fix(string yaml, YamlLintOptions? options = null)` [#](#method-fix-string-officeimo-yaml-yamllintoptions)

[YamlLinter.cs:33](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Yaml/Lint/YamlLinter.cs#L33)

Applies the safe fixes of every enabled rule and returns the repaired text. Each fix replaces only the text of the lines it repairs, so comments, spellings and layout elsewhere stay byte for byte. The repaired text is loaded again and compared with the input; if any value, tag or anchor differs, nothing is applied.

Parameters

**yaml string required**

The text to repair.

**options OfficeIMO.Yaml.YamlLintOptions? = null optional**

The rules to apply, or null for the defaults.

Returns

`YamlLintFixResult`

`public static IReadOnlyList<YamlLintFinding> Lint(string yaml, YamlLintOptions? options = null)` [#](#method-lint-string-officeimo-yaml-yamllintoptions)

[YamlLinter.cs:21](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Yaml/Lint/YamlLinter.cs#L21)

Lints YAML text.

Parameters

**yaml string required**

The text to check.

**options OfficeIMO.Yaml.YamlLintOptions? = null optional**

The rules to apply, or null for the defaults.

Returns

`IReadOnlyList<YamlLintFinding>` The findings, ordered by position.

## Inherited Methods

`public virtual bool Equals(object? obj)` [#](#method-equals-object)

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

`public virtual int GetHashCode()` [#](#method-gethashcode)

Inherited from object

Returns

`int`

`public Type GetType()` [#](#method-gettype)

Inherited from object

Returns

`Type`

`public virtual string? ToString()` [#](#method-tostring)

Inherited from object

Returns

`string?`

<!-- PowerForge markdown artifact sha256:734A17F297670EC15A48CFA887473FF832E8854F5C68E12E4174BFC9B0BD360C -->
