Skip to content

Commit bfde610

Browse files
committed
Maintain SourceKit-mode as long as custom rules don't support SwiftSyntax
#6129 is required for `.swiftsyntax` to become the default.
1 parent 8ada387 commit bfde610

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Source/SwiftLintFramework/Rules/CustomRules.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ struct CustomRules: Rule, CacheDescriptionProvider, ConditionallySourceKitFree {
7575
var isEffectivelySourceKitFree: Bool {
7676
configuration.customRuleConfigurations.allSatisfy { config in
7777
let effectiveMode = config.executionMode == .default
78-
? (configuration.defaultExecutionMode ?? .swiftsyntax)
78+
? (configuration.defaultExecutionMode ?? .sourcekit)
7979
: config.executionMode
8080
return effectiveMode == .swiftsyntax
8181
}

Tests/FrameworkTests/CustomRulesTests.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ final class CustomRulesTests: SwiftLintTestCase {
685685
XCTAssertEqual(violations[1].location.character, 18)
686686
}
687687

688-
func testCustomRuleDefaultsToSwiftSyntaxWhenNoModeSpecified() throws {
688+
func testCustomRuleDefaultsToSourceKitWhenNoModeSpecified() throws {
689689
// When NO execution mode is specified (neither default nor per-rule), it should default to swiftsyntax
690690
let customRules: [String: Any] = [
691691
"no_foo": [
@@ -713,8 +713,8 @@ final class CustomRulesTests: SwiftLintTestCase {
713713
return
714714
}
715715

716-
XCTAssertTrue(customRule.isEffectivelySourceKitFree,
717-
"Rule should be effectively SourceKit-free when defaulting to swiftsyntax")
716+
XCTAssertFalse(customRule.isEffectivelySourceKitFree,
717+
"Rule depends on SourceKit")
718718
}
719719

720720
func testCustomRuleWithMatchKindsUsesSwiftSyntaxWhenConfigured() throws {
@@ -740,8 +740,8 @@ final class CustomRulesTests: SwiftLintTestCase {
740740
XCTAssertEqual(violations[0].location.character, 23) // Position of 'foo' in comment
741741
}
742742

743-
func testCustomRuleWithKindFilteringDefaultsToSwiftSyntax() throws {
744-
// When using kind filtering without specifying mode, it should default to swiftsyntax
743+
func testCustomRuleWithKindFilteringDefaultsToSourceKit() throws {
744+
// When using kind filtering without specifying mode, it should default to sourcekit
745745
let customRules: [String: Any] = [
746746
"no_keywords": [
747747
"regex": "\\b\\w+\\b",
@@ -769,8 +769,8 @@ final class CustomRulesTests: SwiftLintTestCase {
769769
return
770770
}
771771

772-
XCTAssertTrue(customRule.isEffectivelySourceKitFree,
773-
"Rule with kind filtering should default to swiftsyntax mode")
772+
XCTAssertFalse(customRule.isEffectivelySourceKitFree,
773+
"Rule with kind filtering should default to sourcekit mode")
774774
}
775775

776776
func testCustomRuleWithExcludedMatchKindsUsesSwiftSyntaxWithDefaultMode() throws {

0 commit comments

Comments
 (0)