YamlLinter
OfficeIMO.Yaml
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
- The text to repair.
- options OfficeIMO.Yaml.YamlLintOptions? = null
- The rules to apply, or null for the defaults.
Returns
YamlLintFixResultpublic static IReadOnlyList<YamlLintFinding> Lint(string yaml, YamlLintOptions? options = null) #Lints YAML text.
Parameters
- yaml string
- The text to check.
- options OfficeIMO.Yaml.YamlLintOptions? = null
- The rules to apply, or null for the defaults.