linter
linter copied to clipboard
`package_api_docs` false negative
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:
-
DateUtils
is a class with only static members - The whole
date_utils.dart
file contains no doc comments and it's publicly accessible (since it lives inlib
)
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
@pq @bwilkerson
See also #2731 for the avoid_classes_with_only_static_members
false negative. Not sure about the package_api_docs
issue...
The avoid_classes_with_only_static_members
issue has been fixed.
Same here, package_api_docs does not work sometimes...
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
What is the difference between package_api_docs
and public_member_api_docs
? (The docs for those lints aren't very clear.)
https://github.com/dart-lang/linter/issues/1373 😄