Skip to content

Commit

Permalink
Updated paragraph separation in report sections.
Browse files Browse the repository at this point in the history
  • Loading branch information
isoos committed Aug 27, 2024
1 parent 19d3b0c commit ad0baf3
Show file tree
Hide file tree
Showing 36 changed files with 221 additions and 138 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 0.22.12

- Updated report text for `wasm` readiness.
- Updated paragraph separation in report sections.

## 0.22.11

Expand Down
9 changes: 7 additions & 2 deletions lib/src/report/_common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ String _makeSummary(List<Subsection> subsections,
...subsections.map((subsection) {
final paragraphsMarkdown = subsection
.takeIssues(maxIssues)
.map((e) => e.markdown(basePath: basePath));
.map((e) => e.markdown(basePath: basePath))
// ensures that paragraphs are separated but only with a single empty line
.map((p) => p.endsWith('\n') ? p : '$p\n');
final statusMarker = _reportStatusMarker(subsection.status);
return [
'### $statusMarker ${subsection.grantedPoints}/${subsection.maxPoints} points: ${subsection.description}\n',
Expand All @@ -140,7 +142,10 @@ String _makeSummary(List<Subsection> subsections,
...paragraphsMarkdown,
].join('\n');
}),
].join('\n\n');
]
// ensures that paragraphs are separated but only with a single empty line
.map((l) => l.endsWith('\n') ? l : '$l\n')
.join('\n');
}

String? _reportStatusMarker(ReportStatus status) => const {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/version.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: pana
description: PAckage aNAlyzer - produce a report summarizing the health and quality of a Dart package.
version: 0.22.12-dev
version: 0.22.12
repository: https://github.com/dart-lang/pana
topics:
- tool
Expand Down
6 changes: 3 additions & 3 deletions test/goldens/end2end/_dummy_pkg-1.0.0-null-safety.1.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"grantedPoints": 15,
"maxPoints": 30,
"status": "failed",
"summary": "### [x] 0/10 points: Provide a valid `pubspec.yaml`\n\n<details>\n<summary>\nSdk-constraint doesn't allow future stable dart 2.x releases\n</summary>\n\n`pubspec.yaml:6:8`\n\n```\n ╷\n6 │ sdk: \">=2.12.0-0 <2.12.0\"\n │ ^^^^^^^^^^^^^^^^^^^^\n ╵\n```\n\n</details>\n<details>\n<summary>\nThe package description is too short.\n</summary>\n\nAdd more detail to the `description` field of `pubspec.yaml`. Use 60 to 180 characters to describe the package, what it does, and its target use case.\n</details>\n<details>\n<summary>\nFailed to verify repository URL.\n</summary>\n\nPlease provide a valid [`repository`](https://dart.dev/tools/pub/pubspec#repository) URL in `pubspec.yaml`, such that:\n\n * `repository` can be cloned,\n * a clone of the repository contains a `pubspec.yaml`, which:,\n * contains `name: _dummy_pkg`,\n * contains a `version` property, and,\n * does not contain a `publish_to` property.\n\n`pkg/pub_integration/test_data/_dummy_pkg/pubspec.yaml` from the repository has no `version`.\n</details>\n\n### [*] 5/5 points: Provide a valid `README.md`\n\n\n### [x] 0/5 points: Provide a valid `CHANGELOG.md`\n\n<details>\n<summary>\nNo `CHANGELOG.md` found.\n</summary>\n\nChangelog entries help developers follow the progress of your package. Check out the Dart conventions for [Maintaining a package changelog](https://dart.dev/tools/pub/package-layout#changelog).\n</details>\n\n### [*] 10/10 points: Use an OSI-approved license\n\nDetected license: `BSD-3-Clause`."
"summary": "### [x] 0/10 points: Provide a valid `pubspec.yaml`\n\n<details>\n<summary>\nSdk-constraint doesn't allow future stable dart 2.x releases\n</summary>\n\n`pubspec.yaml:6:8`\n\n```\n ╷\n6 │ sdk: \">=2.12.0-0 <2.12.0\"\n │ ^^^^^^^^^^^^^^^^^^^^\n ╵\n```\n\n</details>\n\n<details>\n<summary>\nThe package description is too short.\n</summary>\n\nAdd more detail to the `description` field of `pubspec.yaml`. Use 60 to 180 characters to describe the package, what it does, and its target use case.\n</details>\n\n<details>\n<summary>\nFailed to verify repository URL.\n</summary>\n\nPlease provide a valid [`repository`](https://dart.dev/tools/pub/pubspec#repository) URL in `pubspec.yaml`, such that:\n\n * `repository` can be cloned,\n * a clone of the repository contains a `pubspec.yaml`, which:,\n * contains `name: _dummy_pkg`,\n * contains a `version` property, and,\n * does not contain a `publish_to` property.\n\n`pkg/pub_integration/test_data/_dummy_pkg/pubspec.yaml` from the repository has no `version`.\n</details>\n\n### [*] 5/5 points: Provide a valid `README.md`\n\n### [x] 0/5 points: Provide a valid `CHANGELOG.md`\n\n<details>\n<summary>\nNo `CHANGELOG.md` found.\n</summary>\n\nChangelog entries help developers follow the progress of your package. Check out the Dart conventions for [Maintaining a package changelog](https://dart.dev/tools/pub/package-layout#changelog).\n</details>\n\n### [*] 10/10 points: Use an OSI-approved license\n\nDetected license: `BSD-3-Clause`.\n"
},
{
"id": "documentation",
Expand All @@ -57,7 +57,7 @@
"grantedPoints": 0,
"maxPoints": 20,
"status": "failed",
"summary": "### [x] 0/20 points: Platform support detection failed\n\n<details>\n<summary>\nCould not determine supported platforms as package resolution failed.\n</summary>\n\nRun `dart pub get` for more information.\n</details>\n\n### [x] 0/0 points: WASM compatibility\n\nUnable to detect compatibility with runtime `wasm`, and this package will not be rewarded full points in a future version of the scoring model.\nSee https://dart.dev/web/wasm for details."
"summary": "### [x] 0/20 points: Platform support detection failed\n\n<details>\n<summary>\nCould not determine supported platforms as package resolution failed.\n</summary>\n\nRun `dart pub get` for more information.\n</details>\n\n### [x] 0/0 points: WASM compatibility\n\nUnable to detect compatibility with runtime `wasm`, and this package will not be rewarded full points in a future version of the scoring model.\n\nSee https://dart.dev/web/wasm for details.\n"
},
{
"id": "analysis",
Expand All @@ -73,7 +73,7 @@
"grantedPoints": 0,
"maxPoints": 40,
"status": "failed",
"summary": "### [x] 0/10 points: All of the package dependencies are supported in the latest version\n\n<details>\n<summary>\nSdk constraint doesn't support current Dart version {{sdk-version}}. Cannot run `dart pub outdated`.\n</summary>\n\n`pubspec.yaml:6:8`\n\n```\n ╷\n6 │ sdk: \">=2.12.0-0 <2.12.0\"\n │ ^^^^^^^^^^^^^^^^^^^^\n ╵\n```\n\n</details>\n\n### [x] 0/10 points: Package supports latest stable Dart and Flutter SDKs\n\n<details>\n<summary>\nSdk constraint doesn't support current Dart version {{sdk-version}}.\n</summary>\n\n`pubspec.yaml:6:8`\n\n```\n ╷\n6 │ sdk: \">=2.12.0-0 <2.12.0\"\n │ ^^^^^^^^^^^^^^^^^^^^\n ╵\n```\n\nTry widening the upper boundary of the constraint.\n</details>\n\n### [x] 0/20 points: Compatible with dependency constraint lower bounds\n\n`dart pub downgrade` failed with:\n\n```\nOUT:\nResolving dependencies...\nERR:\nThe current Dart SDK version is {{sdk-version}}.\n\nBecause _dummy_pkg requires SDK version >=2.12.0-0 <2.12.0, version solving failed.\n```\n\nRun `dart pub downgrade` and then `dart analyze` to reproduce the above problem.\n\nYou may run `dart pub upgrade --tighten` to update your dependency constraints, see [dart.dev/go/downgrade-testing](https://dart.dev/go/downgrade-testing) for details."
"summary": "### [x] 0/10 points: All of the package dependencies are supported in the latest version\n\n<details>\n<summary>\nSdk constraint doesn't support current Dart version {{sdk-version}}. Cannot run `dart pub outdated`.\n</summary>\n\n`pubspec.yaml:6:8`\n\n```\n ╷\n6 │ sdk: \">=2.12.0-0 <2.12.0\"\n │ ^^^^^^^^^^^^^^^^^^^^\n ╵\n```\n\n</details>\n\n### [x] 0/10 points: Package supports latest stable Dart and Flutter SDKs\n\n<details>\n<summary>\nSdk constraint doesn't support current Dart version {{sdk-version}}.\n</summary>\n\n`pubspec.yaml:6:8`\n\n```\n ╷\n6 │ sdk: \">=2.12.0-0 <2.12.0\"\n │ ^^^^^^^^^^^^^^^^^^^^\n ╵\n```\n\nTry widening the upper boundary of the constraint.\n</details>\n\n### [x] 0/20 points: Compatible with dependency constraint lower bounds\n\n`dart pub downgrade` failed with:\n\n```\nOUT:\nResolving dependencies...\nERR:\nThe current Dart SDK version is {{sdk-version}}.\n\nBecause _dummy_pkg requires SDK version >=2.12.0-0 <2.12.0, version solving failed.\n```\n\nRun `dart pub downgrade` and then `dart analyze` to reproduce the above problem.\n\nYou may run `dart pub upgrade --tighten` to update your dependency constraints, see [dart.dev/go/downgrade-testing](https://dart.dev/go/downgrade-testing) for details.\n"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ Sdk-constraint doesn't allow future stable dart 2.x releases
```

</details>

<details>
<summary>
The package description is too short.
</summary>

Add more detail to the `description` field of `pubspec.yaml`. Use 60 to 180 characters to describe the package, what it does, and its target use case.
</details>

<details>
<summary>
Failed to verify repository URL.
Expand All @@ -42,7 +44,6 @@ Please provide a valid [`repository`](https://dart.dev/tools/pub/pubspec#reposit

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


### [x] 0/5 points: Provide a valid `CHANGELOG.md`

<details>
Expand All @@ -57,6 +58,7 @@ Changelog entries help developers follow the progress of your package. Check out

Detected license: `BSD-3-Clause`.


## 10/20 Provide documentation

### [x] 0/10 points: 20% or more of the public API has dartdoc comments
Expand All @@ -81,8 +83,10 @@ Run `dart pub get` for more information.
### [x] 0/0 points: WASM compatibility

Unable to detect compatibility with runtime `wasm`, and this package will not be rewarded full points in a future version of the scoring model.

See https://dart.dev/web/wasm for details.


## 0/50 Pass static analysis

### [x] 0/50 points: code has no errors, warnings, lints, or formatting issues
Expand Down Expand Up @@ -149,4 +153,4 @@ Because _dummy_pkg requires SDK version >=2.12.0-0 <2.12.0, version solving fail

Run `dart pub downgrade` and then `dart analyze` to reproduce the above problem.

You may run `dart pub upgrade --tighten` to update your dependency constraints, see [dart.dev/go/downgrade-testing](https://dart.dev/go/downgrade-testing) for details.
You may run `dart pub upgrade --tighten` to update your dependency constraints, see [dart.dev/go/downgrade-testing](https://dart.dev/go/downgrade-testing) for details.
8 changes: 4 additions & 4 deletions test/goldens/end2end/async-2.11.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,23 @@
"grantedPoints": 30,
"maxPoints": 30,
"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`."
"summary": "### [*] 10/10 points: Provide a valid `pubspec.yaml`\n\n### [*] 5/5 points: Provide a valid `README.md`\n\n### [*] 5/5 points: Provide a valid `CHANGELOG.md`\n\n### [*] 10/10 points: Use an OSI-approved license\n\nDetected license: `BSD-3-Clause`.\n"
},
{
"id": "documentation",
"title": "Provide documentation",
"grantedPoints": 10,
"maxPoints": 20,
"status": "failed",
"summary": "### [*] 10/10 points: 20% or more of the public API has dartdoc comments\n\n246 out of 263 API elements (93.5 %) have documentation comments.\n\nSome symbols that are missing documentation: `async.AsyncMemoizer.AsyncMemoizer`, `async.ChunkedStreamReader.ChunkedStreamReader`, `async.DelegatingFuture.DelegatingFuture`, `async.DelegatingStream.DelegatingStream`, `async.ErrorResult.ErrorResult`.\n\n### [x] 0/10 points: Package has an example\n\n<details>\n<summary>\nNo example found.\n</summary>\n\nSee [package layout](https://dart.dev/tools/pub/package-layout#examples) guidelines on how to add an example.\n</details>"
"summary": "### [*] 10/10 points: 20% or more of the public API has dartdoc comments\n\n246 out of 263 API elements (93.5 %) have documentation comments.\n\nSome symbols that are missing documentation: `async.AsyncMemoizer.AsyncMemoizer`, `async.ChunkedStreamReader.ChunkedStreamReader`, `async.DelegatingFuture.DelegatingFuture`, `async.DelegatingStream.DelegatingStream`, `async.ErrorResult.ErrorResult`.\n\n### [x] 0/10 points: Package has an example\n\n<details>\n<summary>\nNo example found.\n</summary>\n\nSee [package layout](https://dart.dev/tools/pub/package-layout#examples) guidelines on how to add an example.\n</details>\n"
},
{
"id": "platform",
"title": "Platform support",
"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\n\n### [*] 0/0 points: WASM compatibility\n\nThis package is compatible with runtime `wasm`, and will be rewarded additional points in a future version of the scoring model.\nSee https://dart.dev/web/wasm for details."
"summary": "### [*] 20/20 points: Supports 6 of 6 possible platforms (**iOS**, **Android**, **Web**, **Windows**, **macOS**, **Linux**)\n\n* ✓ Android\n\n* ✓ iOS\n\n* ✓ Windows\n\n* ✓ Linux\n\n* ✓ macOS\n\n* ✓ Web\n\n### [*] 0/0 points: WASM compatibility\n\nThis package is compatible with runtime `wasm`, and will be rewarded additional points in a future version of the scoring model.\n\nSee https://dart.dev/web/wasm for details.\n"
},
{
"id": "analysis",
Expand All @@ -103,7 +103,7 @@
"grantedPoints": 40,
"maxPoints": 40,
"status": "passed",
"summary": "### [*] 10/10 points: All of the package dependencies are supported in the latest version\n\n|Package|Constraint|Compatible|Latest|\n|:-|:-|:-|:-|\n|[`collection`]|`^1.15.0`|1.18.0|1.18.0|\n|[`meta`]|`^1.1.7`|1.15.0|1.15.0|\n\nTo reproduce run `dart pub outdated --no-dev-dependencies --up-to-date --no-dependency-overrides`.\n\n[`collection`]: https://pub.dev/packages/collection\n[`meta`]: https://pub.dev/packages/meta\n\n\n### [*] 10/10 points: Package supports latest stable Dart and Flutter SDKs\n\n\n### [*] 20/20 points: Compatible with dependency constraint lower bounds\n\n`pub downgrade` does not expose any static analysis error."
"summary": "### [*] 10/10 points: All of the package dependencies are supported in the latest version\n\n|Package|Constraint|Compatible|Latest|\n|:-|:-|:-|:-|\n|[`collection`]|`^1.15.0`|1.18.0|1.18.0|\n|[`meta`]|`^1.1.7`|1.15.0|1.15.0|\n\nTo reproduce run `dart pub outdated --no-dev-dependencies --up-to-date --no-dependency-overrides`.\n\n[`collection`]: https://pub.dev/packages/collection\n[`meta`]: https://pub.dev/packages/meta\n\n### [*] 10/10 points: Package supports latest stable Dart and Flutter SDKs\n\n### [*] 20/20 points: Compatible with dependency constraint lower bounds\n\n`pub downgrade` does not expose any static analysis error.\n"
}
]
},
Expand Down
16 changes: 10 additions & 6 deletions test/goldens/end2end/async-2.11.0.json_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@

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


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


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


### [*] 10/10 points: Use an OSI-approved license

Detected license: `BSD-3-Clause`.


## 10/20 Provide documentation

### [*] 10/10 points: 20% or more of the public API has dartdoc comments
Expand All @@ -31,22 +29,30 @@ No example found.
See [package layout](https://dart.dev/tools/pub/package-layout#examples) guidelines on how to add an example.
</details>


## 20/20 Platform support

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

* ✓ Android

* ✓ iOS

* ✓ Windows

* ✓ Linux

* ✓ macOS

* ✓ Web

### [*] 0/0 points: WASM compatibility

This package is compatible with runtime `wasm`, and will be rewarded additional points in a future version of the scoring model.

See https://dart.dev/web/wasm for details.


## 50/50 Pass static analysis

### [*] 50/50 points: code has no errors, warnings, lints, or formatting issues
Expand All @@ -66,10 +72,8 @@ To reproduce run `dart pub outdated --no-dev-dependencies --up-to-date --no-depe
[`collection`]: https://pub.dev/packages/collection
[`meta`]: https://pub.dev/packages/meta


### [*] 10/10 points: Package supports latest stable Dart and Flutter SDKs


### [*] 20/20 points: Compatible with dependency constraint lower bounds

`pub downgrade` does not expose any static analysis error.
`pub downgrade` does not expose any static analysis error.
Loading

0 comments on commit ad0baf3

Please sign in to comment.