MCPcopy Create free account
hub / github.com/vale-cli/vale / Conditional

Struct Conditional

internal/check/conditional.go:13–30  ·  view source on GitHub ↗

Conditional ensures that the present of First ensures the present of Second.

Source from the content-addressed store, hash-verified

11
12// Conditional ensures that the present of First ensures the present of Second.
13type Conditional struct {
14 Definition `mapstructure:",squash"`
15 Exceptions []string
16 patterns []*regexp2.Regexp
17 First string
18 Second string
19 exceptRe *regexp2.Regexp
20 phraseRe *regexp2.Regexp
21 Ignorecase bool
22 Vocab bool
23
24 // secondHasGroup records whether `Second` has a capture group. When it
25 // does, a `First` match is allowed only if its value was captured by a
26 // `Second` match (e.g. an acronym defined as `... (WHO)`). When it doesn't,
27 // the rule is a plain presence check: any `First` requires `Second` to
28 // appear somewhere in the same block. See #1048.
29 secondHasGroup bool
30}
31
32// hasCaptureGroup reports whether `pattern` contains a capturing group -- an
33// unescaped `(` that doesn't begin a non-capturing/extension group `(?...)`.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected