Strict Fileprivate

fileprivate should be avoided

  • Identifier: strict_fileprivate
  • 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

extension String {}
private extension String {}
public
    extension String {
        var i: Int { 1 }
    }
    private enum E {
        func f() {}
    }
    public struct S {
        internal let i: Int
    }
    open class C {
        private func f() {}
    }
    internal actor A {}

Triggering Examples

    fileprivate class C {
        fileprivate func f() {}
    }
    fileprivate extension String {
        fileprivate var isSomething: Bool { self == "something" }
    }
    fileprivate actor A {
        fileprivate let i = 1
    }
    fileprivate struct C {
        fileprivate(set) var myInt = 4
    }
    struct Outter {
        struct Inter {
            fileprivate struct Inner {}
        }
    }