SwiftLint icon indicating copy to clipboard operation
SwiftLint copied to clipboard

missing_docs doesn't trigger for non-inherited properties/functions when using excludes_inherited_types

Open bobbradley opened this issue 8 months ago • 1 comments

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
}

bobbradley avatar Jun 18 '24 22:06 bobbradley