Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package_api_docs false negative #58385

Open
afgriffiths opened this issue May 1, 2021 · 7 comments
Open

package_api_docs false negative #58385

afgriffiths opened this issue May 1, 2021 · 7 comments
Labels
analyzer-linter Issues with the analyzer's support for the linter package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. linter-false-negative P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@afgriffiths
Copy link

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 in lib)

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
Copy link
Contributor

@pq @bwilkerson

@pq pq transferred this issue from dart-lang/sdk May 10, 2021
@srawlins srawlins added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Jun 18, 2021
@pq
Copy link
Member

pq commented Jul 6, 2021

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

@pq
Copy link
Member

pq commented Nov 15, 2022

The avoid_classes_with_only_static_members issue has been fixed.

@pq pq changed the title Problems with at least two analyzer rules: avoid_classes_with_only_static_members and package_api_docs in Dart 2.12.3 package_api_docs false negative Nov 15, 2022
@pq pq added linter-false-negative P3 A lower priority bug or feature request labels Nov 15, 2022
@fzyzcjy
Copy link
Contributor

fzyzcjy commented Nov 20, 2023

Same here, package_api_docs does not work sometimes...

@pq
Copy link
Member

pq commented Apr 22, 2024

As of #58734, 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
Copy link
Member

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

@pq
Copy link
Member

pq commented Apr 22, 2024

#57877 😄

@devoncarew devoncarew added analyzer-linter Issues with the analyzer's support for the linter package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. labels Nov 19, 2024
@devoncarew devoncarew transferred this issue from dart-lang/linter Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-linter Issues with the analyzer's support for the linter package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. linter-false-negative P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

7 participants