Documentation
Table of Contents

Method Parse

Namespace
IntentSharp.Guardrails
Assembly
IntentSharp.Guardrails.dll

Parse(IReadOnlyList<KeyValuePair<string, string>>, GuardrailSourceOptions?)

Reads rule files and compiled companions. Each document is a path and its text: a path ending in .rules.json, .rules.yaml or .rules.yml is a rule file, one ending in .rules.compiled.json is the companion of the rule file whose path it derives from, and its rules follow that set's own. A document with any problem adds nothing. A set name defined by two documents is served as rules.ambiguousSet in CodeSettings says: by neither, with a problem that names both (serveNeither, the default), or by the document given first (firstWins). Never throws for content.

public static GuardrailFileSet Parse(IReadOnlyList<KeyValuePair<string, string>> documents, GuardrailSourceOptions? options = null)

Parameters

documents IReadOnlyList<KeyValuePair<string, string>>

Each document's path, relative to its store's root, and its text.

options GuardrailSourceOptions

The kinds, subjects and settings a rule file may name beyond the library's own, and the code settings; null for none.

Returns

GuardrailFileSet

The sets that loaded, with each set's document and content hash, and every problem with its line.

Exceptions

ArgumentNullException

documents, a path or a text is null.

ArgumentException

A path is not a document path, or a code setting is not declared or not valid.