Region

public struct Region : Equatable

A contiguous region of Swift source code.

  • The location describing the start of the region. All locations that are less than this value (earlier in the source file) are not contained in this region.

    Declaration

    Swift

    public let start: Location
  • end

    The location describing the end of the region. All locations that are greater than this value (later in the source file) are not contained in this region.

    Declaration

    Swift

    public let end: Location
  • All SwiftLint rule identifiers that are disabled in this region.

    Declaration

    Swift

    public let disabledRuleIdentifiers: Set<RuleIdentifier>
  • Creates a Region by setting explicit values for all its properties.

    Declaration

    Swift

    public init(start: Location, end: Location, disabledRuleIdentifiers: Set<RuleIdentifier>)

    Parameters

    start

    The region’s starting location.

    end

    The region’s ending location.

    disabledRuleIdentifiers

    All SwiftLint rule identifiers that are disabled in this region.

  • Whether the specific location is contained in this region.

    Declaration

    Swift

    public func contains(_ location: Location) -> Bool

    Parameters

    location

    The location to check for containment.

    Return Value

    True if the specific location is contained in this region.

  • Whether the specified rule is enabled in this region.

    Declaration

    Swift

    public func isRuleEnabled(_ rule: some Rule) -> Bool

    Parameters

    rule

    The rule whose status should be determined.

    Return Value

    True if the specified rule is enabled in this region.

  • Whether the specified rule is disabled in this region.

    Declaration

    Swift

    public func isRuleDisabled(_ rule: some Rule) -> Bool

    Parameters

    rule

    The rule whose status should be determined.

    Return Value

    True if the specified rule is disabled in this region.

  • Whether the given rules are disabled in this region.

    Declaration

    Swift

    public func areRulesDisabled(ruleIDs: [String]) -> Bool

    Parameters

    ruleIDs

    A list of rule IDs. Typically all identifiers of a single rule.

    Return Value

    True if the specified rules are disabled in this region.

  • Returns the deprecated rule aliases that are disabling the specified rule in this region. Returns the empty set if the rule isn’t disabled in this region.

    Declaration

    Swift

    public func deprecatedAliasesDisabling(rule: some Rule) -> Set<String>

    Parameters

    rule

    The rule to check.

    Return Value

    Deprecated rule aliases.