Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Source/SwiftLintFramework/Rules/CustomRules.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ struct CustomRules: Rule, CacheDescriptionProvider, ConditionallySourceKitFree {
var isEffectivelySourceKitFree: Bool {
configuration.customRuleConfigurations.allSatisfy { config in
let effectiveMode = config.executionMode == .default
? (configuration.defaultExecutionMode ?? .swiftsyntax)
? (configuration.defaultExecutionMode ?? .sourcekit)
: config.executionMode
return effectiveMode == .swiftsyntax
}
Expand Down
14 changes: 7 additions & 7 deletions Tests/FrameworkTests/CustomRulesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ final class CustomRulesTests: SwiftLintTestCase {
XCTAssertEqual(violations[1].location.character, 18)
}

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

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

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

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

XCTAssertTrue(customRule.isEffectivelySourceKitFree,
"Rule with kind filtering should default to swiftsyntax mode")
XCTAssertFalse(customRule.isEffectivelySourceKitFree,
"Rule with kind filtering should default to sourcekit mode")
}

func testCustomRuleWithExcludedMatchKindsUsesSwiftSyntaxWithDefaultMode() throws {
Expand Down