Skip to content

Commit

Permalink
Don't reduce points when pubspec URLs are unreachable, but repository…
Browse files Browse the repository at this point in the history
… is verified. (#1332)
  • Loading branch information
isoos authored Feb 6, 2024
1 parent 4783061 commit f52951f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
16 changes: 14 additions & 2 deletions lib/src/report/template.dart
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,20 @@ Future<ReportSection> followsTemplate(PackageContext context) async {
'${repository!.verificationFailure}'));
}

final status = issues.isEmpty ? ReportStatus.passed : ReportStatus.failed;
final points = issues.isEmpty ? 10 : 0;
final unreachableFailuresIgnored =
// every issue is about an URL being unreachable
issues.isNotEmpty &&
issues.every((issue) =>
(issue.suggestion ?? '').contains('was unreachable')) &&
// repository verification succeeded
repository?.repository != null;

final status = issues.isEmpty
? ReportStatus.passed
: (unreachableFailuresIgnored
? ReportStatus.partial
: ReportStatus.failed);
final points = (issues.isEmpty || unreachableFailuresIgnored) ? 10 : 0;
return Subsection(
'Provide a valid `pubspec.yaml`',
issues,
Expand Down
8 changes: 4 additions & 4 deletions test/goldens/end2end/url_launcher-6.1.12.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@
{
"id": "convention",
"title": "Follow Dart file conventions",
"grantedPoints": 20,
"grantedPoints": 30,
"maxPoints": 30,
"status": "failed",
"summary": "### [x] 0/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": "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`."
},
{
"id": "documentation",
Expand Down Expand Up @@ -164,7 +164,7 @@
"path": "packages/url_launcher/url_launcher"
},
"contributingUrl": "https://github.com/flutter/packages/blob/main/CONTRIBUTING.md",
"grantedPoints": 130,
"grantedPoints": 140,
"maxPoints": 140
},
"urlProblems": []
Expand Down
4 changes: 2 additions & 2 deletions test/goldens/end2end/url_launcher-6.1.12.json_report.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## 20/30 Follow Dart file conventions
## 30/30 Follow Dart file conventions

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

<details>
<summary>
Expand Down

0 comments on commit f52951f

Please sign in to comment.