Missing Docs

Declarations should be documented.

  • Identifier: missing_docs
  • Enabled by default: No
  • Supports autocorrection: No
  • Kind: lint
  • Analyzer rule: No
  • Minimum Swift compiler version: 5.0.0
  • Default configuration:
    KeyValue
    warning [open, public]
    excludes_extensions true
    excludes_inherited_types true
    excludes_trivial_init false
    evaluate_effective_access_control_level false

Non Triggering Examples

/// docs
public class A {
/// docs
public func b() {}
}
// no docs
public class B: A { override public func b() {} }
import Foundation
// no docs
public class B: NSObject {
// no docs
override public var description: String { fatalError() } }
/// docs
public class A {
    var j = 1
    var i: Int { 1 }
    func f() {}
    deinit {}
}
public extension A {}
enum E {
    case A
}
//
// excludes_trivial_init: true
//

/// docs
public class A {
    public init() {}
}

//
// evaluate_effective_access_control_level: true
//

class C {
    public func f() {}
}

public struct S: ~Copyable, P {
    public init() {}
}

Triggering Examples

public func a() {}
// regular comment
public func a() {}
/* regular comment */
public func a() {}
/// docs
public protocol A {
    // no docs
    var b: Int { get }
}
/// docs
public struct C: A {
    public let b: Int
}
/// a doc
public class C {
    public static let i = 1
}
public extension A {
    public func f() {}
    static var i: Int { 1 }
    struct S {
        func f() {}
    }
    class C {
        func f() {}
    }
    actor A {
        func f() {}
    }
    enum E {
        case a
        func f() {}
    }
}
public extension A {
    enum E {
        enum Inner {
            case a
        }
    }
}
extension E {
    public struct S {
        public static let i = 1
    }
}
extension E {
    public func f() {}
}
//
// excludes_trivial_init: true
//

/// docs
public class A {
    public init(argument: String) {}
}

//
// excludes_inherited_types: false
//

public struct C: A {
    public let b: Int
}

//
// excludes_extensions: false
//

public extension A {
    public func f() {}
}

public extension E {
    var i: Int {
        let j = 1
        func f() {}
        return j
    }
}
#if os(macOS)
public func f() {}
#endif
public enum E {
    case A, B
    func f() {}
    init(_ i: Int) { self = .A }
}
/// a doc
public struct S {}
public extension S {
    enum E {
        case A
    }
}
//
// evaluate_effective_access_control_level: false
//

class C {
    public func f() {}
}

public struct S: ~Copyable, ~Escapable {
    public init() {}
}