Swiftlint: False negative in valid_docs rules

Created on 8 Aug 2016  路  3Comments  路  Source: realm/SwiftLint

I tend to add a MARK: comment when I override a protocol implementation, like so:

class SomeLayoutAttributes: UICollectionViewLayoutAttributes {
    /// MARK: - NSCopying
    override func copyWithZone(zone: NSZone) -> AnyObject {
    }
}

Currently, this gives me a Valid Docs Violation. I would say that this is a false negative. Would it make sense to add logic to the rule such that it does not trigger for documentation that includes a MARK but is not valid documentation?

Most helpful comment

Hey Lars @larslockefeer ,
As far as I know triple forward-slash are used to describe documentation for the declaration right below.

If you would use double forward-slash MARK you should be fine.
e.g. // MARK: - NSCopying

All 3 comments

Hey Lars @larslockefeer ,
As far as I know triple forward-slash are used to describe documentation for the declaration right below.

If you would use double forward-slash MARK you should be fine.
e.g. // MARK: - NSCopying

@freak4pc's recommendation is correct. MARK-style comments should be double-slashed, not triple.

Thanks @freak4pc for the recommendation!

Was this page helpful?
0 / 5 - 0 ratings