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 about actors not documenting public protocol properties #5422

Open
2 tasks done
bobbradley opened this issue Jan 16, 2024 · 6 comments · May be fixed by #5465
Open
2 tasks done

missing_docs warns about actors not documenting public protocol properties #5422

bobbradley opened this issue Jan 16, 2024 · 6 comments · May be fixed by #5465

Comments

@bobbradley
Copy link

New Issue Checklist

Describe the bug

If you use the "actor" keyword, it implicitly conforms to the "Actor" protocol, but SwiftLint still warns about not documenting public properties from the Actor protocol. For example, if you provide a public "unownedExecutor", it warns about it not documenting it. But if you explicitly conform to "Actor" then it doesn't warn.

It seems like SwiftLint should treat actors as if they explicitly specified they conform to the "Actor" protocol.

Generates warnings

/// Documentation for MyActor.
public final actor MyActor {
    public nonisolated var unownedExecutor: UnownedSerialExecutor { ... } // Warns here
}

No warnings

/// Documentation for MyActor.
public final actor MyActor: Actor {
    public nonisolated var unownedExecutor: UnownedSerialExecutor { ... }
}
Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint lint

Environment

  • SwiftLint version (run swiftlint version to be sure)? 0.53.0
  • Installation method used (Homebrew, CocoaPods, building from source, etc)? homebrew
  • Paste your configuration file:
opt_in_rules:
  - missing_docs
  • Are you using nested configurations?
    No

  • Which Xcode version are you using (check xcodebuild -version)?
    Invoking SwiftLint directly.

  • Do you have a sample that shows the issue?
    Pasted above.

@SimplyDanny
Copy link
Collaborator

The reason you don't get a warning in the second case (explicitly conforming to Actor) might be the option excludes_inherited_types which is true by default.

However, I agree that the rule could know about the protocol methods an actor type comes with by default so it doesn't trigger on them.

@marunomi
Copy link
Contributor

marunomi commented Feb 5, 2024

Hi, Can I work on this?🙂

@SimplyDanny
Copy link
Collaborator

Hi, Can I work on this?🙂

Sure. Please go ahead.

@marunomi
Copy link
Contributor

marunomi commented Feb 16, 2024

I tried to fix this.
But as I saw some merged pull requests that rewriting to use Swift Syntax, would I better to change whole file to Swift Syntax use?

@SimplyDanny
Copy link
Collaborator

SimplyDanny commented Feb 17, 2024

I tried to fix this. But as I saw some merged pull requests that rewriting to use Swift Syntax, would I better to change whole file to Swift Syntax use?

There is a rewrite in #5048 already, but we haven't found the time to review it. It would indeed make sense to wait for it, before this change gets added.

@marunomi
Copy link
Contributor

marunomi commented Feb 19, 2024

There is a rewrite in #5048 already, but we haven't found the time to review it. It would indeed make sense to wait for it, before this change gets added.

OK 👍🏻
I got it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants