Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions pkgs/firehose/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.11.0

- Bump dart_apitool which can now report leak locations.

## 0.10.5

- Bump dart_apitool to work with non-published dev dependencies.
Expand Down
41 changes: 33 additions & 8 deletions pkgs/firehose/lib/src/health/health.dart
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ ${changeForPackage.entries.map((e) => '|${e.key.name}|${e.value.toMarkdownRow()}

Future<HealthCheckResult> leakingCheck() async {
var filesInPR = await listFilesInPRorAll();
final leaksForPackage = <Package, List<String>>{};
final leaksInPackages = <(Package, Leak)>[];

final flutterPackages =
packagesContaining(filesInPR, only: flutterPackageGlobs);
Expand Down Expand Up @@ -310,7 +310,10 @@ ${changeForPackage.entries.map((e) => '|${e.key.name}|${e.value.toMarkdownRow()}
var leaks = decoded['missingEntryPoints'] as List<dynamic>;

if (leaks.isNotEmpty) {
leaksForPackage[package] = leaks.cast();
leaksInPackages.addAll(leaks.map(
(leakJson) =>
(package, Leak.fromJson(leakJson as Map<String, dynamic>)),
));

final desc = leaks.map((item) => '$item').join(', ');
log('Leaked symbols found: $desc.');
Expand All @@ -334,15 +337,13 @@ ${changeForPackage.entries.map((e) => '|${e.key.name}|${e.value.toMarkdownRow()}
}
return HealthCheckResult(
Check.leaking,
leaksForPackage.values.any((leaks) => leaks.isNotEmpty)
? Severity.warning
: Severity.success,
leaksInPackages.isNotEmpty ? Severity.warning : Severity.success,
'''
The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

| Package | Leaked API symbols |
| :--- | :--- |
${leaksForPackage.entries.map((e) => '|${e.key.name}|${e.value.join('<br>')}|').join('\n')}
| Package | Leaked API symbol | Leaking sources |
| :--- | :--- | :--- |
${leaksInPackages.map((e) => '|${e.$1.name}|${e.$2.name}|${e.$2.usages.join('<br>')}|').join('\n')}
''',
);
}
Expand Down Expand Up @@ -548,6 +549,30 @@ ${isWorseThanInfo ? 'This check can be disabled by tagging the PR with `skip-${r
}
}

class Leak {
/// The type of the leak, e.g., 'interface'.
final String type;

/// A list of strings representing where the leak is used.
final List<String> usages;

final String name;

Leak._({
required this.type,
required this.usages,
required this.name,
});

factory Leak.fromJson(Map<String, dynamic> json) {
return Leak._(
type: json['type'] as String,
usages: (json['usages'] as List<dynamic>).cast<String>(),
name: json['name'] as String,
);
}
}

enum BreakingLevel {
none('None'),
nonBreaking('Non-Breaking'),
Expand Down
2 changes: 1 addition & 1 deletion pkgs/firehose/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: firehose
description: A tool to automate publishing of Pub packages from GitHub actions.
version: 0.10.5
version: 0.11.0
repository: https://github.com/dart-lang/ecosystem/tree/main/pkgs/firehose

environment:
Expand Down
8 changes: 5 additions & 3 deletions pkgs/firehose/test_data/golden/comment_leaking.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@

The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

| Package | Leaked API symbols |
| :--- | :--- |
|package5|NonExported<br>NonExported2<br>TransitiveNonExported|
| Package | Leaked API symbol | Leaking sources |
| :--- | :--- | :--- |
|package5|NonExported|package5_base.dart::Awesome::myClass|
|package5|NonExported2|package5_base.dart::Awesome::myClass2|
|package5|TransitiveNonExported|package5_base.dart::NonExported2::myClass|


This check can be disabled by tagging the PR with `skip-leaking-check`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@

The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

| Package | Leaked API symbols |
| :--- | :--- |
|package5|NonExported<br>NonExported2<br>TransitiveNonExported|
| Package | Leaked API symbol | Leaking sources |
| :--- | :--- | :--- |
|package5|NonExported|package5_base.dart::Awesome::myClass|
|package5|NonExported2|package5_base.dart::Awesome::myClass2|
|package5|TransitiveNonExported|package5_base.dart::NonExported2::myClass|


This check can be disabled by tagging the PR with `skip-leaking-check`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@

The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

| Package | Leaked API symbols |
| :--- | :--- |
|package5|NonExported<br>NonExported2<br>TransitiveNonExported|
| Package | Leaked API symbol | Leaking sources |
| :--- | :--- | :--- |
|package5|NonExported|package5_base.dart::Awesome::myClass|
|package5|NonExported2|package5_base.dart::Awesome::myClass2|
|package5|TransitiveNonExported|package5_base.dart::NonExported2::myClass|


This check can be disabled by tagging the PR with `skip-leaking-check`.
Expand Down
Loading