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 doesn't trigger for non-inherited properties/functions when using excludes_inherited_types #5633

Open
2 tasks done
bobbradley opened this issue Jun 18, 2024 · 1 comment
Labels
acceptable-false-positive False positives caused by rules that are unavoidable due to missing type information. bug Unexpected and reproducible misbehavior.

Comments

@bobbradley
Copy link

New Issue Checklist

Describe the bug

If missing_docs is enabled and excludes_inherited_types is true then undocumented and non-inherited public properties/functions don't trigger missing_docs warnings if the type inherits from a protocol. For example:

/// My type.
public struct MyType: Identifiable {
    public id: String // No warning expected here because this property comes from `Identifiable`.

    // Warning expected here because it's not inherited from `Identifiable`, but warning is not reported.
    public name: String
}
Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint lint
Linting Swift files in current working directory
Linting 'Test.swift' (1/1)
Done linting! Found 0 violations, 0 serious in 1 file.

Environment

  • SwiftLint version: 0.55.1
  • Installation method used: Homebrew
  • Paste your configuration file:
opt_in_rules:
  - missing_docs

missing_docs:
  excludes_inherited_types: true
  • Are you using nested configurations?
    No
  • Which Xcode version are you using (check xcodebuild -version)?
    Reproduces without Xcode.
  • Do you have a sample that shows the issue?
    Yes:
/// My type.
public struct MyType: Identifiable {
    public id: String // No warning expected here because this property comes from `Identifiable`.

    // Warning expected here because it's not inherited from `Identifiable`, but warning is not reported.
    public name: String
}
@SimplyDanny
Copy link
Collaborator

SwiftLint works on the syntax level only. So it doesn't know which declarations exactly stem from a protocol or parent class. This is why excludes_inherited_types exists and, with it enabled, the rule ignores inheriting types completely.

@SimplyDanny SimplyDanny added bug Unexpected and reproducible misbehavior. acceptable-false-positive False positives caused by rules that are unavoidable due to missing type information. labels Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acceptable-false-positive False positives caused by rules that are unavoidable due to missing type information. bug Unexpected and reproducible misbehavior.
Projects
None yet
Development

No branches or pull requests

2 participants