dart-lang / linter

Linter for Dart.
https://dart.dev/tools/linter-rules
BSD 3-Clause "New" or "Revised" License
628 stars 170 forks source link

Lint `public_member_api_docs` false positive #5070

Open matanlurey opened 1 month ago

matanlurey commented 1 month ago

The analyzer and dartdoc understand this is documented, but the lint rule does not:

// lib/format.dart
/// A format.
class Format {
  /// Is documented to do a thing.
  void doThing() {}
}

/// A mixin that adds a method to [Format].
mixin FormatMixin1 on Format {
  @override
  void doThing({String? optionalString}) {}
}

/// A mixin that adds a method to [Format].
mixin FormatMixin2 on Format {
  @override
  void doThing({int? optionalInteger}) {}
}

/// A mixin that is both [FormatMixin1] and [FormatMixin2].
mixin FormatMixins on Format implements FormatMixin1, FormatMixin2 {
  // Missing documentation for a public member.
  // Try adding documentation for the member.dart[public_member_api_docs] 
  // (https://dart.dev/lints/public_member_api_docs)
  @override
  void doThing({String? optionalString, int? optionalInteger}) {}
}

Dart SDK version: 3.5.0 (stable) (Tue Jul 30 02:17:59 2024 -0700) on "macos_arm64"

dart-github-bot commented 1 month ago

Summary: The public_member_api_docs lint incorrectly flags a method in a mixin as undocumented, even though the method is documented in a superclass mixin. This occurs when a mixin inherits from multiple mixins, each of which overrides the same method with different optional parameters.