@@ -2,11 +2,11 @@ import Foundation
22
33// MARK: - CustomRulesConfiguration
44
5- struct CustomRulesConfiguration : RuleConfiguration , CacheDescriptionProvider {
6- typealias Parent = CustomRules
5+ package struct CustomRulesConfiguration : RuleConfiguration , CacheDescriptionProvider {
6+ package typealias Parent = CustomRules
77
8- var parameterDescription : RuleConfigurationDescription ? { RuleConfigurationOption . noOptions }
9- var cacheDescription : String {
8+ package var parameterDescription : RuleConfigurationDescription ? { RuleConfigurationOption . noOptions }
9+ package var cacheDescription : String {
1010 let configsDescription = customRuleConfigurations
1111 . sorted { $0. identifier < $1. identifier }
1212 . map ( \. cacheDescription)
@@ -20,7 +20,7 @@ struct CustomRulesConfiguration: RuleConfiguration, CacheDescriptionProvider {
2020 var customRuleConfigurations = [ RegexConfiguration < Parent > ] ( )
2121 var defaultExecutionMode : RegexConfiguration < Parent > . ExecutionMode ?
2222
23- mutating func apply( configuration: Any ) throws ( Issue) {
23+ package mutating func apply( configuration: Any ) throws ( Issue) {
2424 guard let configurationDict = configuration as? [ String : Any ] else {
2525 throw . invalidConfiguration( ruleID: Parent . identifier)
2626 }
@@ -52,16 +52,20 @@ struct CustomRulesConfiguration: RuleConfiguration, CacheDescriptionProvider {
5252// MARK: - CustomRules
5353
5454@DisabledWithoutSourceKit
55- struct CustomRules : Rule , CacheDescriptionProvider , ConditionallySourceKitFree {
56- var cacheDescription : String {
55+ package struct CustomRules : Rule , CacheDescriptionProvider , ConditionallySourceKitFree {
56+ package init ( ) {
57+ // Nothing to initialize.
58+ }
59+
60+ package var cacheDescription : String {
5761 configuration. cacheDescription
5862 }
5963
6064 var customRuleIdentifiers : [ String ] {
6165 configuration. customRuleConfigurations. map ( \. identifier)
6266 }
6367
64- static let description = RuleDescription (
68+ package static let description = RuleDescription (
6569 identifier: " custom_rules " ,
6670 name: " Custom Rules " ,
6771 description: """
@@ -71,10 +75,10 @@ struct CustomRules: Rule, CacheDescriptionProvider, ConditionallySourceKitFree {
7175 """ ,
7276 kind: . style)
7377
74- var configuration = CustomRulesConfiguration ( )
78+ package var configuration = CustomRulesConfiguration ( )
7579
7680 /// Returns true if all configured custom rules use SwiftSyntax mode, making this rule effectively SourceKit-free.
77- var isEffectivelySourceKitFree : Bool {
81+ package var isEffectivelySourceKitFree : Bool {
7882 configuration. customRuleConfigurations. allSatisfy { config in
7983 let effectiveMode = config. executionMode == . default
8084 ? ( configuration. defaultExecutionMode ?? . sourcekit)
@@ -83,7 +87,7 @@ struct CustomRules: Rule, CacheDescriptionProvider, ConditionallySourceKitFree {
8387 }
8488 }
8589
86- func validate( file: SwiftLintFile ) -> [ StyleViolation ] {
90+ package func validate( file: SwiftLintFile ) -> [ StyleViolation ] {
8791 var configurations = configuration. customRuleConfigurations
8892
8993 guard configurations. isNotEmpty else {
@@ -114,7 +118,7 @@ struct CustomRules: Rule, CacheDescriptionProvider, ConditionallySourceKitFree {
114118 }
115119 }
116120
117- func canBeDisabled( violation: StyleViolation , by ruleID: RuleIdentifier ) -> Bool {
121+ package func canBeDisabled( violation: StyleViolation , by ruleID: RuleIdentifier ) -> Bool {
118122 switch ruleID {
119123 case let . single( identifier: id) :
120124 id == Self . identifier
@@ -125,7 +129,7 @@ struct CustomRules: Rule, CacheDescriptionProvider, ConditionallySourceKitFree {
125129 }
126130 }
127131
128- func isEnabled( in region: Region , for ruleID: String ) -> Bool {
132+ package func isEnabled( in region: Region , for ruleID: String ) -> Bool {
129133 if !Self. description. allIdentifiers. contains ( ruleID) ,
130134 !customRuleIdentifiers. contains ( ruleID) ,
131135 Self . identifier != ruleID {
0 commit comments