Baseline

public struct Baseline : Equatable

A set of violations that can be used to filter newly detected violations.

  • The stored violations.

    Declaration

    Swift

    public var violations: [StyleViolation] { get }
  • Creates a Baseline from a saved file.

    Declaration

    Swift

    public init(fromPath path: String) throws

    Parameters

    fromPath

    The path to read from.

  • Creates a Baseline from a list of violations.

    Declaration

    Swift

    public init(violations: [StyleViolation])

    Parameters

    violations

    The violations for the baseline.

  • Writes a Baseline to disk in JSON format.

    Declaration

    Swift

    public func write(toPath path: String) throws

    Parameters

    toPath

    The path to write to.

  • Filters out violations that are present in the Baseline.

    Assumes that all violations are from the same file.

    Declaration

    Swift

    public func filter(_ violations: [StyleViolation]) -> [StyleViolation]

    Parameters

    violations

    The violations to filter.

    Return Value

    The new violations.

  • Returns the violations that are present in another Baseline, but not in this one.

    The violations are filtered using the same algorithm as the filter method above.

    Declaration

    Swift

    public func compare(_ otherBaseline: Baseline) -> [StyleViolation]

    Parameters

    otherBaseline

    The other Baseline.