Explicit ACL

All declarations should specify Access Control Level keywords explicitly

  • Identifier: explicit_acl
  • Enabled by default: No
  • Supports autocorrection: No
  • Kind: idiomatic
  • Analyzer rule: No
  • Minimum Swift compiler version: 5.0.0
  • Default configuration:
    KeyValue
    severity warning

Non Triggering Examples

internal enum A {}
public final class B {}
private struct C {}
internal enum A { internal enum B {} }
internal final class Foo {}
internal
class Foo {
  private let bar = 5
}
internal func a() { let a =  }
private func a() { func innerFunction() { } }
private enum Foo { enum Bar { } }
private struct C { let d = 5 }
internal protocol A {
  func b()
}
internal protocol A {
  var b: Int
}
internal class A { deinit {} }
extension A: Equatable {}
extension A {}
extension Foo {
    internal func bar() {}
}
internal enum Foo {
    case bar
}
extension Foo {
    public var isValid: Bool {
        let result = true
        return result
    }
}
extension Foo {
    private var isValid: Bool {
        get {
            return true
        }
        set(newValue) {
            print(newValue)
        }
    }
}
private extension Foo {
    var isValid: Bool { true }
    struct S {
        let b = 2
    }
}

Triggering Examples

enum A {}
final class B {}
internal struct C { let d = 5 }
public struct C { private(set) var d = 5 }
internal struct C { static let d = 5 }
public struct C { let d = 5 }
public struct C { init() }
static func a() {}
internal let a = 0
func b() {}
extension Foo {
    func bar() {}
    static func baz() {}
}
public extension E {
    let a = 1
    struct S {
        let b = 2
    }
}