Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

YamlLinter

OfficeIMO.Yaml

Namespace
OfficeIMO.Yaml
Assembly
OfficeIMO.Yaml
Source revision
ba882f6b0d07 with working tree changes
Modifiers
static

Checks YAML text against a configurable rule set modelled on yamllint (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 error and the line rules, without fixes.

Methods

public static YamlLintFixResult Fix(string yaml, YamlLintOptions? options = null) #

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.
public static IReadOnlyList<YamlLintFinding> Lint(string yaml, YamlLintOptions? options = null) #

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.