critic-fix(validation): make rules immutable

This commit is contained in:
Mihaela Mihaljevic 2026-06-05 11:27:06 +02:00
parent 66de760ff2
commit e26c0917d4
2 changed files with 4 additions and 3 deletions

View File

@ -55,3 +55,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
and install Linux Swift toolchain prerequisites for the WASM CI job.
- Harden duplicate-key validation to use set membership while preserving exact
diagnostics.
- Make validation rules immutable after construction.

View File

@ -1,9 +1,9 @@
public extension PureYAML.Validation {
/// A validation rule that can report zero or more path-aware issues.
struct Rule: Sendable {
public var description: String
public var predicate: @Sendable (Context) -> Bool
public var check: @Sendable (Context) -> [Issue]
public let description: String
public let predicate: @Sendable (Context) -> Bool
public let check: @Sendable (Context) -> [Issue]
public init(
description: String,