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

Don't reduce points when pubspec URLs are unreachable, but repository is verified. #1332

Merged
merged 1 commit into from
Feb 6, 2024
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
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",
Copy link
Contributor

Choose a reason for hiding this comment

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

How come this is partial when it has 30/30 ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I see that is the rule you define above...

"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