diff --git a/CHANGELOG.md b/CHANGELOG.md index c7a22140d..1b36709c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,12 @@ [Martin Redington](https://github.com/mildm8nnered) [#4896](https://github.com/realm/SwiftLint/issues/4896) +* Stop enforcing calls to super from the override functions `setUp()`, + `tearDown()`, `setUpWithError()`, and `tearDownWithError()` in `XCTestCase` + subclasses. + [AndrewDMontgomery](https://github.com/andrewdmontgomery) + [#4875](https://github.com/realm/SwiftLint/pull/4875) + #### Bug Fixes * Fix `lower_acl_than_parent` rule rewriter by preserving leading whitespace. diff --git a/Source/SwiftLintFramework/Rules/Lint/TestCaseAccessibilityRuleExamples.swift b/Source/SwiftLintFramework/Rules/Lint/TestCaseAccessibilityRuleExamples.swift index 2a312b385..de9a850d4 100644 --- a/Source/SwiftLintFramework/Rules/Lint/TestCaseAccessibilityRuleExamples.swift +++ b/Source/SwiftLintFramework/Rules/Lint/TestCaseAccessibilityRuleExamples.swift @@ -14,29 +14,17 @@ internal struct TestCaseAccessibilityRuleExamples { return nestedMember } - override static func setUp() { - super.setUp() - } + override static func setUp() {} - override func setUp() { - super.setUp() - } + override func setUp() {} - override func setUpWithError() throws { - try super.setUpWithError() - } + override func setUpWithError() throws {} - override static func tearDown() { - super.tearDown() - } + override static func tearDown() {} - override func tearDown() { - super.tearDown() - } + override func tearDown() {} - override func tearDownWithError() { - try super.tearDownWithError() - } + override func tearDownWithError() {} override func someFutureXCTestFunction() { super.someFutureXCTestFunction() diff --git a/Source/SwiftLintFramework/Rules/RuleConfigurations/OverriddenSuperCallConfiguration.swift b/Source/SwiftLintFramework/Rules/RuleConfigurations/OverriddenSuperCallConfiguration.swift index c24ce4852..366076fb9 100644 --- a/Source/SwiftLintFramework/Rules/RuleConfigurations/OverriddenSuperCallConfiguration.swift +++ b/Source/SwiftLintFramework/Rules/RuleConfigurations/OverriddenSuperCallConfiguration.swift @@ -26,12 +26,7 @@ struct OverriddenSuperCallConfiguration: SeverityBasedRuleConfiguration, Equatab "viewDidDisappear(_:)", "viewDidLoad()", "viewWillAppear(_:)", - "viewWillDisappear(_:)", - // XCTestCase - "setUp()", - "setUpWithError()", - "tearDown()", - "tearDownWithError()" + "viewWillDisappear(_:)" ] private(set) var severityConfiguration = SeverityConfiguration(.warning)