realm / realm/SwiftLint

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

Open
#5,633 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

acceptable-false-positive bug
Dominant language
Swift
Stars
19.7k
Forks
2.3k
Avg merge
1d 1h
Merged PRs (30d)
11

Description

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
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the provided Swift sample and missing_docs configuration, then run swiftlint lint. Trace the missing_docs rule's handling of inherited types; done means the inherited id remains exempt while the non-inherited public name produces a warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.