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

is:wasm-ready tag #1336

Merged
merged 13 commits into from
Feb 9, 2024
8 changes: 4 additions & 4 deletions lib/src/report/multi_platform.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Future<ReportSection> multiPlatform(String packageDir, Pubspec pubspec) async {

Subsection scorePlatforms(
List<String> tags, List<Explanation> explanations) {
// Scoring and the report only takes these platforms into account.
final tagNames = const {
PanaTags.platformIos: 'iOS',
PanaTags.platformAndroid: 'Android',
Expand All @@ -45,12 +46,13 @@ Future<ReportSection> multiPlatform(String packageDir, Pubspec pubspec) async {
PanaTags.platformMacos: 'macOS',
PanaTags.platformLinux: 'Linux',
};
final officialTags = tags.where(tagNames.containsKey).toList();
final sdkExplanations =
explanations.where((e) => e.tag != null && e.tag!.startsWith('sdk:'));
final platformExplanations = explanations
.where((e) => e.tag == null || !e.tag!.startsWith('sdk:'));
final officialExplanations = platformExplanations.where((e) =>
!tags.contains(e.tag) &&
!officialTags.contains(e.tag) &&
(e.tag == null || tagNames.containsKey(e.tag)));
final trustExplanations = explanations.where((e) => tags.contains(e.tag));
final paragraphs = <Paragraph>[
Expand All @@ -59,7 +61,7 @@ Future<ReportSection> multiPlatform(String packageDir, Pubspec pubspec) async {
if (sdkExplanations.isNotEmpty)
// This empty line is required for `package:markdown` to render the following list correctly.
RawParagraph(''),
for (final tag in tags.where((e) => e.startsWith('platform')))
for (final tag in officialTags.where((e) => e.startsWith('platform')))
RawParagraph('* ✓ ${tagNames[tag]}'),
if (officialExplanations.isNotEmpty)
RawParagraph('\nThese platforms are not supported:\n'),
Expand All @@ -70,8 +72,6 @@ Future<ReportSection> multiPlatform(String packageDir, Pubspec pubspec) async {
...trustExplanations.map(explanationToIssue),
];

final officialTags = tags.where(tagNames.containsKey).toList();

final status =
officialTags.where((tag) => tag.startsWith('platform:')).isEmpty
? ReportStatus.failed
Expand Down
7 changes: 7 additions & 0 deletions lib/src/tag/_specs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class Runtime {
nativeAot,
nativeJit,
web,
wasm,
];

static final nativeAot = Runtime(
Expand All @@ -89,6 +90,12 @@ class Runtime {
tag: PanaTags.runtimeWeb,
);

static final wasm = Runtime(
'wasm',
{..._onAllPlatforms, 'ui', 'ui_web', 'js_interop', 'js_interop_unsafe'},
sigurdm marked this conversation as resolved.
Show resolved Hide resolved
tag: PanaTags.isWasmReady,
);

static final flutterNative = Runtime(
'flutter-native',
{
Expand Down
1 change: 1 addition & 0 deletions lib/src/tag/pana_tags.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ abstract class PanaTags {
static const runtimeFlutterNative = 'runtime:flutter-native';
static const runtimeFlutterWeb = 'runtime:flutter-web';
static const runtimeWeb = 'runtime:web';
static const isWasmReady = 'is:wasm-ready';

// platform tags
static const platformAndroid = 'platform:android';
Expand Down
1 change: 1 addition & 0 deletions test/goldens/end2end/async-2.11.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"runtime:native-aot",
"runtime:native-jit",
"runtime:web",
"is:wasm-ready",
"is:null-safe",
"is:dart3-compatible",
"license:bsd-3-clause",
Expand Down
10 changes: 5 additions & 5 deletions test/goldens/end2end/audio_service-0.18.10.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,15 @@
"grantedPoints": 20,
"maxPoints": 20,
"status": "passed",
"summary": "### [*] 20/20 points: Supports 4 of 6 possible platforms (**iOS**, **Android**, **Web**, Windows, **macOS**, Linux)\n\n* ✓ Android\n* ✓ iOS\n* ✓ macOS\n* ✓ Web\n\nThese platforms are not supported:\n\n<details>\n<summary>\nPackage does not support platform `Windows`.\n</summary>\n\nBecause:\n* `package:audio_service/audio_service.dart` that declares support for platforms: `Android`, `iOS`, `macOS`, `Web`.\n</details>\n<details>\n<summary>\nPackage does not support platform `Linux`.\n</summary>\n\nBecause:\n* `package:audio_service/audio_service.dart` that declares support for platforms: `Android`, `iOS`, `macOS`, `Web`.\n</details>\n\nThese issues are present but do not affect the score, because they may not originate in your package:\n\n<details>\n<summary>\nPackage does not support platform `Web`.\n</summary>\n\nBecause:\n* `package:audio_service/audio_service.dart` that imports:\n* `package:flutter_cache_manager/flutter_cache_manager.dart` that imports:\n* `package:flutter_cache_manager/src/storage/cache_info_repositories/cache_info_repositories.dart` that imports:\n* `package:flutter_cache_manager/src/storage/cache_info_repositories/json_cache_info_repository.dart` that imports:\n* `package:path_provider/path_provider.dart` that declares support for platforms: `Android`, `iOS`, `Windows`, `Linux`, `macOS`.\n</details>"
"summary": "### [*] 20/20 points: Supports 4 of 6 possible platforms (**iOS**, **Android**, **Web**, Windows, **MacOS**, Linux)\n\n* ✓ Android\n* ✓ iOS\n* ✓ MacOS\n* ✓ Web\n\nThese platforms are not supported:\n\n<details>\n<summary>\nPackage does not support platform `Windows`.\n</summary>\n\nBecause:\n* `package:audio_service/audio_service.dart` that declares support for platforms: `Android`, `iOS`, `macOS`, `Web`.\n</details>\n<details>\n<summary>\nPackage does not support platform `Linux`.\n</summary>\n\nBecause:\n* `package:audio_service/audio_service.dart` that declares support for platforms: `Android`, `iOS`, `macOS`, `Web`.\n</details>\n\nThese issues are present but do not affect the score, because they may not originate in your package:\n\n<details>\n<summary>\nPackage does not support platform `Web`.\n</summary>\n\nBecause:\n* `package:audio_service/audio_service.dart` that imports:\n* `package:flutter_cache_manager/flutter_cache_manager.dart` that imports:\n* `package:flutter_cache_manager/src/storage/cache_info_repositories/cache_info_repositories.dart` that imports:\n* `package:flutter_cache_manager/src/storage/cache_info_repositories/json_cache_info_repository.dart` that imports:\n* `package:path_provider/path_provider.dart` that declares support for platforms: `Android`, `iOS`, `Windows`, `Linux`, `macOS`.\n</details>"
},
{
"id": "analysis",
"title": "Pass static analysis",
"grantedPoints": 50,
"grantedPoints": 40,
"maxPoints": 50,
"status": "passed",
"summary": "### [*] 50/50 points: code has no errors, warnings, lints, or formatting issues\n"
"status": "partial",
"summary": "### [~] 40/50 points: code has no errors, warnings, lints, or formatting issues\n\nFound 16 issues. Showing the first 2:\n\n<details>\n<summary>\nINFO: Unclosed instance of 'Sink'.\n</summary>\n\n`lib/audio_service.dart:1943:40`\n\n```\n ╷\n1943 │ final BehaviorSubject<PlaybackState> _playbackState = BehaviorSubject();\n │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n ╵\n```\n\nTo reproduce make sure you are using the [lints_core](https://pub.dev/packages/lints) and run `flutter analyze lib/audio_service.dart`\n</details>\n<details>\n<summary>\nINFO: Unclosed instance of 'Sink'.\n</summary>\n\n`lib/audio_service.dart:1944:42`\n\n```\n ╷\n1944 │ final BehaviorSubject<List<MediaItem>> _queue = BehaviorSubject();\n │ ^^^^^^^^^^^^^^^^^^^^^^^^^^\n ╵\n```\n\nTo reproduce make sure you are using the [lints_core](https://pub.dev/packages/lints) and run `flutter analyze lib/audio_service.dart`\n</details>"
},
{
"id": "dependency",
Expand All @@ -186,7 +186,7 @@
"path": "audio_service"
},
"contributingUrl": "https://github.com/ryanheise/audio_service/blob/minor/CONTRIBUTING.md",
"grantedPoints": 130,
"grantedPoints": 120,
"maxPoints": 130
},
"urlProblems": []
Expand Down
42 changes: 38 additions & 4 deletions test/goldens/end2end/audio_service-0.18.10.json_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ Detected license: `MIT`.

## 20/20 Platform support

### [*] 20/20 points: Supports 4 of 6 possible platforms (**iOS**, **Android**, **Web**, Windows, **macOS**, Linux)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you need to rebase the PR on HEAD.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah thanks! - I was getting very confused

### [*] 20/20 points: Supports 4 of 6 possible platforms (**iOS**, **Android**, **Web**, Windows, **MacOS**, Linux)

* ✓ Android
* ✓ iOS
* ✓ macOS
* ✓ MacOS
* ✓ Web

These platforms are not supported:
Expand Down Expand Up @@ -61,10 +61,44 @@ Because:
* `package:path_provider/path_provider.dart` that declares support for platforms: `Android`, `iOS`, `Windows`, `Linux`, `macOS`.
</details>

## 50/50 Pass static analysis
## 40/50 Pass static analysis

### [*] 50/50 points: code has no errors, warnings, lints, or formatting issues
### [~] 40/50 points: code has no errors, warnings, lints, or formatting issues

Found 16 issues. Showing the first 2:

<details>
<summary>
INFO: Unclosed instance of 'Sink'.
</summary>

`lib/audio_service.dart:1943:40`

```
1943 │ final BehaviorSubject<PlaybackState> _playbackState = BehaviorSubject();
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

To reproduce make sure you are using the [lints_core](https://pub.dev/packages/lints) and run `flutter analyze lib/audio_service.dart`
</details>
<details>
<summary>
INFO: Unclosed instance of 'Sink'.
</summary>

`lib/audio_service.dart:1944:42`

```
1944 │ final BehaviorSubject<List<MediaItem>> _queue = BehaviorSubject();
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^
```

To reproduce make sure you are using the [lints_core](https://pub.dev/packages/lints) and run `flutter analyze lib/audio_service.dart`
</details>

## 20/20 Support up-to-date dependencies

Expand Down
1 change: 1 addition & 0 deletions test/goldens/end2end/http-0.13.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"runtime:native-aot",
"runtime:native-jit",
"runtime:web",
"is:wasm-ready",
"is:null-safe",
"is:dart3-compatible",
"license:bsd-3-clause",
Expand Down
1 change: 1 addition & 0 deletions test/goldens/end2end/lints-1.0.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"runtime:native-aot",
"runtime:native-jit",
"runtime:web",
"is:wasm-ready",
"is:null-safe",
"is:dart3-compatible",
"license:bsd-3-clause",
Expand Down
2 changes: 1 addition & 1 deletion test/goldens/end2end/nsd_android-1.2.2.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"grantedPoints": 20,
"maxPoints": 20,
"status": "passed",
"summary": "### [*] 20/20 points: Supports 1 of 6 possible platforms (iOS, **Android**, Web, Windows, macOS, Linux)\n\n* ✓ Android\n\nThese platforms are not supported:\n\n<details>\n<summary>\nPackage does not support platform `iOS`.\n</summary>\n\nBecause:\n* `nsd_android` that declares support for platforms: `Android`.\n</details>\n<details>\n<summary>\nPackage does not support platform `Windows`.\n</summary>\n\nBecause:\n* `nsd_android` that declares support for platforms: `Android`.\n</details>\n<details>\n<summary>\nPackage does not support platform `Linux`.\n</summary>\n\nBecause:\n* `nsd_android` that declares support for platforms: `Android`.\n</details>\n<details>\n<summary>\nPackage does not support platform `macOS`.\n</summary>\n\nBecause:\n* `nsd_android` that declares support for platforms: `Android`.\n</details>\n<details>\n<summary>\nPackage does not support platform `Web`.\n</summary>\n\nBecause:\n* `nsd_android` that declares support for platforms: `Android`.\n</details>"
"summary": "### [*] 20/20 points: Supports 1 of 6 possible platforms (iOS, **Android**, Web, Windows, MacOS, Linux)\n\n* ✓ Android\n\nThese platforms are not supported:\n\n<details>\n<summary>\nPackage does not support platform `iOS`.\n</summary>\n\nBecause:\n* `nsd_android` that declares support for platforms: `Android`.\n</details>\n<details>\n<summary>\nPackage does not support platform `Windows`.\n</summary>\n\nBecause:\n* `nsd_android` that declares support for platforms: `Android`.\n</details>\n<details>\n<summary>\nPackage does not support platform `Linux`.\n</summary>\n\nBecause:\n* `nsd_android` that declares support for platforms: `Android`.\n</details>\n<details>\n<summary>\nPackage does not support platform `macOS`.\n</summary>\n\nBecause:\n* `nsd_android` that declares support for platforms: `Android`.\n</details>\n<details>\n<summary>\nPackage does not support platform `Web`.\n</summary>\n\nBecause:\n* `nsd_android` that declares support for platforms: `Android`.\n</details>"
},
{
"id": "analysis",
Expand Down
2 changes: 1 addition & 1 deletion test/goldens/end2end/nsd_android-1.2.2.json_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ See [package layout](https://dart.dev/tools/pub/package-layout#examples) guideli

## 20/20 Platform support

### [*] 20/20 points: Supports 1 of 6 possible platforms (iOS, **Android**, Web, Windows, macOS, Linux)
### [*] 20/20 points: Supports 1 of 6 possible platforms (iOS, **Android**, Web, Windows, MacOS, Linux)

* ✓ Android

Expand Down
7 changes: 4 additions & 3 deletions test/goldens/end2end/url_launcher-6.1.12.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@
"title": "Follow Dart file conventions",
"grantedPoints": 30,
"maxPoints": 30,
"status": "partial",
"summary": "### [~] 10/10 points: Provide a valid `pubspec.yaml`\n\n<details>\n<summary>\nIssue tracker URL doesn't exist.\n</summary>\n\nAt the time of the analysis `https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+url_launcher%22` was unreachable. Make sure that the website is reachable via [`HEAD`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD) requests.\n</details>\n\n### [*] 5/5 points: Provide a valid `README.md`\n\n\n### [*] 5/5 points: Provide a valid `CHANGELOG.md`\n\n\n### [*] 10/10 points: Use an OSI-approved license\n\nDetected license: `BSD-3-Clause`."
"status": "passed",
"summary": "### [*] 10/10 points: Provide a valid `pubspec.yaml`\n\n\n### [*] 5/5 points: Provide a valid `README.md`\n\n\n### [*] 5/5 points: Provide a valid `CHANGELOG.md`\n\n\n### [*] 10/10 points: Use an OSI-approved license\n\nDetected license: `BSD-3-Clause`."
},
{
"id": "documentation",
Expand All @@ -133,7 +133,7 @@
"grantedPoints": 20,
"maxPoints": 20,
"status": "passed",
"summary": "### [*] 20/20 points: Supports 6 of 6 possible platforms (**iOS**, **Android**, **Web**, **Windows**, **macOS**, **Linux**)\n\n* ✓ Android\n* ✓ iOS\n* ✓ Windows\n* ✓ Linux\n* ✓ macOS\n* ✓ Web"
"summary": "### [*] 20/20 points: Supports 6 of 6 possible platforms (**iOS**, **Android**, **Web**, **Windows**, **MacOS**, **Linux**)\n\n* ✓ Android\n* ✓ iOS\n* ✓ Windows\n* ✓ Linux\n* ✓ MacOS\n* ✓ Web"
},
{
"id": "analysis",
Expand All @@ -156,6 +156,7 @@
"screenshots": [],
"result": {
"repositoryUrl": "https://github.com/flutter/packages/tree/main/packages/url_launcher/url_launcher",
"issueTrackerUrl": "https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+url_launcher%22",
"repository": {
"provider": "github",
"host": "github.com",
Expand Down
13 changes: 3 additions & 10 deletions test/goldens/end2end/url_launcher-6.1.12.json_report.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
## 30/30 Follow Dart file conventions

### [~] 10/10 points: Provide a valid `pubspec.yaml`
### [*] 10/10 points: Provide a valid `pubspec.yaml`

<details>
<summary>
Issue tracker URL doesn't exist.
</summary>

At the time of the analysis `https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+url_launcher%22` was unreachable. Make sure that the website is reachable via [`HEAD`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD) requests.
</details>

### [*] 5/5 points: Provide a valid `README.md`

Expand All @@ -33,13 +26,13 @@ Some symbols that are missing documentation: `link`, `url_launcher`, `url_launch

## 20/20 Platform support

### [*] 20/20 points: Supports 6 of 6 possible platforms (**iOS**, **Android**, **Web**, **Windows**, **macOS**, **Linux**)
### [*] 20/20 points: Supports 6 of 6 possible platforms (**iOS**, **Android**, **Web**, **Windows**, **MacOS**, **Linux**)

* ✓ Android
* ✓ iOS
* ✓ Windows
* ✓ Linux
* ✓ macOS
* ✓ MacOS
* ✓ Web

## 50/50 Pass static analysis
Expand Down
1 change: 1 addition & 0 deletions test/tag/tag_end2end_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ void main() {
'runtime:native-jit',
'runtime:native-aot',
'runtime:web',
'is:wasm-ready',
},
explanations: isEmpty);
_expectTagging(tagger.flutterPluginTags, tags: isEmpty);
Expand Down