Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[missing_docs] warns for deinit when using Swift 5 #2690

Closed
thibault-ml opened this issue Mar 26, 2019 · 1 comment · Fixed by #2844

Comments

@thibault-ml
Copy link

commented Mar 26, 2019

New Issue Checklist

Describe the bug

When using Swift 5, the missing_docs lint warns for all deinit that do not have a documentation. This is a regression as it does not happen when using Swift 4.2.1.

deinit is not a "public" method that really needs documenting: it is simply part of the language, just like willSet, didSet, etc. Even more so, Xcode's "Add Documentation" menu item fails saying "Nothing found to document at the current location".

Complete output when running SwiftLint, including the stack trace and command used
$ swift --version
Apple Swift version 5.0 (swiftlang-1001.0.69.5 clang-1001.0.46.3)
Target: x86_64-apple-darwin18.2.0
$ printf "/// documentation\npublic class Hello { deinit { } }\n" | swiftlint lint --no-cache --use-stdin --enable-all-rules
<nopath>:2:22: warning: Missing Docs Violation: public declarations should be documented. (missing_docs)
Done linting! Found 1 violation, 0 serious in 1 file.

$ swift --version
Apple Swift version 4.2.1 (swiftlang-1000.11.42 clang-1000.11.45.1)
Target: x86_64-apple-darwin18.2.0
$ printf "/// documentation\npublic class Hello { deinit { } }\n" | swiftlint lint --no-cache --use-stdin --enable-all-rules
Done linting! Found 0 violations, 0 serious in 1 file.

Environment

  • SwiftLint version: 0.31.0
  • Installation method used: Homebrew
  • Irrelevant of configuration file
  • Xcode 10.2 (Swift 5)
@johnfairh

This comment has been minimized.

Copy link

commented Mar 29, 2019

This is due to a change in how SourceKit reports accessibility in Swift 5 (same thing as #2607). For deinit this effectively now means "if there is no explicit access attr then report same accessibility as the parent decl".

@marcelofabri marcelofabri added the bug label Apr 1, 2019

marcelofabri added a commit that referenced this issue Aug 25, 2019
marcelofabri added a commit that referenced this issue Aug 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.