Skip to content

Commit 625cd18

Browse files
authored
Fix type_contents_order initializer detection (realm#3622)
1 parent dd672b4 commit 625cd18

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
[namolnad](https://github.com/namolnad)
3131
[#3597](https://github.com/realm/SwiftLint/pull/3597)
3232

33+
* Fix `type_contents_order` initializer detection.
34+
[StevenMagdy](https://github.com/StevenMagdy)
35+
3336
## 0.43.1: Laundroformat
3437

3538
#### Breaking

Source/SwiftLintFramework/Rules/Style/TypeContentsOrderRule.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public struct TypeContentsOrderRule: ConfigurationProviderRule, OptInRule {
121121
"viewDidDisappear("
122122
]
123123

124-
if typeContentStructure.name!.starts(with: "init") {
124+
if typeContentStructure.name!.starts(with: "init(") {
125125
return .initializer
126126
} else if typeContentStructure.name!.starts(with: "deinit") {
127127
return .deinitializer

Tests/SwiftLintFrameworkTests/TypeContentsOrderRuleTests.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,9 @@ class TypeContentsOrderRuleTests: XCTestCase {
247247
// Other Method
248248
func goToInfoVc() { /* TODO */ }
249249
250+
// Other Method
251+
func initInfoVc () { /* TODO */ }
252+
250253
// IBAction
251254
@IBAction func goNextButtonPressed() {
252255
goToNextVc()

0 commit comments

Comments
 (0)