dart-lang / linter

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

`package_api_docs` false negative #2630

Open afgriffiths opened 3 years ago

afgriffiths commented 3 years ago

Steps to Reproduce

Create a new Dart project (designed to be a consumable package). Add the following contents to analysis_options.yaml

linter:
  rules:
    - avoid_classes_with_only_static_members
    - package_api_docs

In lib create a new file called date_utils.dart with the following contents (lifted straight from the bad example at the page for the avoid_classes_with_only_static_members lint):

class DateUtils {
  static DateTime mostRecent(List<DateTime> dates) {
    return dates.reduce((a, b) => a.isAfter(b) ? a : b);
  }
}

Expected behaviour

Running dart analyze in the directory should complain of a violation of both avoid_classes_with_only_static_members and package_api_docs since:

Actual behaviour

Run dart analyze in the directory and observe that no violations are found.

Environment Information

Dart Version: 2.12.3 Operating System: Windows 10 64-bit

scheglov commented 3 years ago

@pq @bwilkerson

pq commented 3 years ago

See also #2731 for the avoid_classes_with_only_static_members false negative. Not sure about the package_api_docs issue...

pq commented 1 year ago

The avoid_classes_with_only_static_members issue has been fixed.

fzyzcjy commented 9 months ago

Same here, package_api_docs does not work sometimes...

pq commented 4 months ago

As of https://github.com/dart-lang/linter/issues/3395, this lint is essentially a no-op. Assuming interest, we could revisit I think given the new workspace support. Alternatively we should deprecate and remove.

/fyi @bwilkerson @keertip

bwilkerson commented 4 months ago

What is the difference between package_api_docs and public_member_api_docs? (The docs for those lints aren't very clear.)

pq commented 4 months ago

https://github.com/dart-lang/linter/issues/1373 😄