redundant_set_access_control - ApplebaumIan/BitbucketAPI GitHub Wiki

Redundant Set Access Control Rule

Property setter access level shouldn't be explicit if it's the same as the variable access level.

  • Identifier: redundant_set_access_control
  • Enabled by default: Enabled
  • Supports autocorrection: No
  • Kind: idiomatic
  • Analyzer rule: No
  • Minimum Swift compiler version: 4.1.0
  • Default configuration: warning

Non Triggering Examples

private(set) public var foo: Int
public let foo: Int
public var foo: Int
var foo: Int
private final class A {
  private(set) var value: Int
}

Triggering Examples

↓private(set) private var foo: Int
↓fileprivate(set) fileprivate var foo: Int
↓internal(set) internal var foo: Int
↓public(set) public var foo: Int
open class Foo {
  ↓open(set) open var bar: Int
}
class A {
  ↓internal(set) var value: Int
}
fileprivate class A {
  ↓fileprivate(set) var value: Int
}