Skip to content

Fix lints and tests. #4070

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

Merged
merged 3 commits into from
Jul 1, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/src/model/canonicalization.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ final class _Canonicalization {
Element2? ancestor = element;
while (ancestor != null) {
if (ancestor is LibraryElement2) {
components.insert(0, ancestor.identifier);
components.insert(0, ancestor.uri.toString());
} else {
components.insert(0, ancestor.name3!);
}
Expand Down
9 changes: 5 additions & 4 deletions lib/src/model/model_element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -412,11 +412,12 @@ abstract class ModelElement
return false;
}

if (element case LibraryElement2(:var identifier, :var firstFragment)) {
if (element case LibraryElement2(:var uri, :var firstFragment)) {
final url = uri.toString();
// Private Dart SDK libraries are not public.
if (identifier.startsWith('dart:_') ||
identifier.startsWith('dart:nativewrappers/') ||
'dart:nativewrappers' == identifier) {
if (url.startsWith('dart:_') ||
url.startsWith('dart:nativewrappers/') ||
url == 'dart:nativewrappers') {
return false;
}
// Package-private libraries are not public.
Expand Down
2 changes: 1 addition & 1 deletion test/end2end/dartdoc_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void main() {
expect(
useSomethingInAnotherPackage.modelType.linkedName,
matches(
r'<a class="deprecated" href="https://pub.dev/documentation/meta/[^"]*/meta/Required-class.html">Required</a>'));
r'<a href="https://pub.dev/documentation/meta/[^"]*/meta/Required-class.html">Required</a>\?'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this test change a consequence of the change above, or is it an already failing test thats fixed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated the regexp PTAL, apparently different test versions output different text.

var link = RegExp('/dart-core/String-class.html">String</a>');
expect(useSomethingInTheSdk.modelType.linkedName, contains(link));
});
Expand Down
Loading