Self Binding

Re-bind self to a consistent identifier name.

  • Identifier: self_binding
  • Enabled by default: No
  • Supports autocorrection: Yes
  • Kind: style
  • Analyzer rule: No
  • Minimum Swift compiler version: 5.0.0
  • Default configuration:
    KeyValue
    severity warning
    bind_identifier “self”

Non Triggering Examples

if let self = self { return }
guard let self = self else { return }
if let this = this { return }
guard let this = this else { return }
//
// bind_identifier: "this"
//

if let this = self { return }

//
// bind_identifier: "this"
//

guard let this = self else { return }

Triggering Examples

if let `self` = self { return }
guard let `self` = self else { return }
if let this = self { return }
guard let this = self else { return }
//
// bind_identifier: "this"
//

if let self = self { return }

//
// bind_identifier: "this"
//

guard let self = self else { return }

//
// bind_identifier: "this"
//

if let self { return }

//
// bind_identifier: "this"
//

guard let self else { return }