redundant_optional_initialization removes opening bracket before property observer #3718
Closed
Description
New Issue Checklist
- Updated SwiftLint to the latest version
- I searched for existing GitHub issues
Describe the bug
The redundant_optional_initialization rule removes the opening bracket before a property observer which causes a syntax issue. For example
var foo: String? = nil {
didSet {
print("foo")
}
}
is changed to
var foo: String?
didSet {
print("foo")
}
}
Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint lint
Linting Swift files in current working directory
Linting 'Foo.swift' (1/1)
/Foo.swift:3:21: warning: Redundant Optional Initialization Violation: Initializing an optional variable with nil is redundant. (redundant_optional_initialization)
Done linting! Found 1 violation, 0 serious in 1 file.
Environment
$ swiftlint version
swiftlint version
0.44.0
Metadata
Assignees
Labels
No labels