New Issue Checklist
Bug Description
Sample Code
import os
class Name {
private let test = ""
func testLog() {
Logger(subsystem: "sub", category: "cat").warning("test: \(self.test, privacy: .private(mask: .hash))")
}
}
SwiftLint output:
$ swiftlint
Linting Swift files in current working directory
Linting 'a.swift' (1/1)
~/Desktop/a.swift:7:68: warning: Redundant Self Violation: Explicit use of 'self' is not required (redundant_self)
Done linting! Found 1 violation, 0 serious in 1 file.
When removing the self. from the self.test:
$ swift a.swift
a.swift:7:68: error: reference to property 'test' in closure requires explicit use of 'self' to make capture semantics explicit
5 |
6 | func testLog() {
7 | Logger(subsystem: "sub", category: "cat").warning("test: \(test, privacy: .private(mask: .hash))")
| |- error: reference to property 'test' in closure requires explicit use of 'self' to make capture semantics explicit
| `- note: reference 'self.' explicitly
8 | }
9 | }
Environment
- SwiftLint version (run
swiftlint version to be sure): 0.63.2
- Xcode version (run
xcodebuild -version to be sure): Xcode 26.3 Build version 17C529
- Installation method used (Homebrew, CocoaPods, building from source, etc): Homebrew
- Configuration file:
opt_in_rules:
- redundant_self
redundant_self:
only_in_closures: false
New Issue Checklist
Bug Description
Sample Code
SwiftLint output:
When removing the
self.from theself.test:Environment
swiftlint versionto be sure): 0.63.2xcodebuild -versionto be sure): Xcode 26.3 Build version 17C529