Skip to content

Commit 7ba2c3f

Browse files
authored
[tool] triage report csv output (#8282)
See #8101. Adds CSV output to make importing into sheets easier: ``` ☁ flutter-intellij [master] ⚡ dart tool/triage/bin/triage.dart issues: 743 (+ 6 PRs) unprioritized: 684 (92%) created within ... | 1 week | 2 weeks | 1 month | 3 months | 1 year | 3 years | longer | | --- | --- | --- | --- | --- | --- | --- | | 2 | 1 | 0 | 8 | 53 | 182 | 438 | 06/24/2025, 2, 1, 0, 8, 53, 182, 438, , 743, 684 ``` --- - [ ] I’ve reviewed the contributor guide and applied the relevant portions to this PR. <details> <summary>Contribution guidelines:</summary><br> - See our [contributor guide]([https://github.com/dart-lang/sdk/blob/main/CONTRIBUTING.md](https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview) for general expectations for PRs. - Larger or significant changes should be discussed in an issue before creating a PR. - Dart contributions to our repos should follow the [Dart style guide](https://dart.dev/guides/language/effective-dart) and use `dart format`. - Java and Kotlin contributions should strive to follow Java and Kotlin best practices ([discussion](#8098)). </details>
1 parent a86bbee commit 7ba2c3f

File tree

3 files changed

+49
-40
lines changed

3 files changed

+49
-40
lines changed

tool/triage/bin/triage.dart

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// found in the LICENSE file.
44

55
import 'package:github/github.dart';
6+
import 'package:intl/intl.dart';
67
import 'package:triage/github.dart';
78

89
/// Print a simple triage report.
@@ -14,10 +15,55 @@ Future<void> main(List<String> args) async {
1415
var issueCount = filtered.length;
1516
var unprioritized = filtered.where((issue) => !issue.prioritized);
1617
var unpriortizedCount = unprioritized.length;
18+
printCreationTimeCounts(unprioritized, issueCount: issueCount, prCount: prCount, unpriortizedCount: unpriortizedCount);
19+
}
20+
21+
22+
void printCreationTimeCounts(Iterable<Issue> issues, {required int issueCount, required int prCount, required int unpriortizedCount} ) {
23+
var seven = 0;
24+
var fourteen = 0;
25+
var twentyEight = 0;
26+
var ninety = 0;
27+
var threeSixty = 0;
28+
var tenEighty = 0;
29+
var beyond = 0;
30+
31+
var now = DateTime.timestamp();
32+
for (var issue in issues) {
33+
var updated = issue.createdAt!;
34+
var daysSinceUpdate = now.difference(updated).inDays;
35+
switch (daysSinceUpdate) {
36+
case <= 7:
37+
++seven;
38+
case > 7 && <= 14:
39+
++fourteen;
40+
case > 14 && <= 28:
41+
++twentyEight;
42+
case > 28 && <= 90:
43+
++ninety;
44+
case > 90 && <= 360:
45+
++threeSixty;
46+
case > 360 && <= 1080:
47+
++tenEighty;
48+
case _:
49+
++beyond;
50+
}
51+
}
1752

1853
print('issues: $issueCount (+ $prCount PRs)');
54+
var unprioritizedPercentage = '${(unpriortizedCount / issueCount).toStringAsFixed(2).substring(2)}%';
1955
print(
20-
'unprioritized: $unpriortizedCount (${(unpriortizedCount / issueCount).toStringAsFixed(2).substring(2)}%)');
56+
'unprioritized: $unpriortizedCount ($unprioritizedPercentage)');
2157
print('created within ...');
22-
printCreationTimeCounts(unprioritized);
58+
59+
var timeData = [seven, fourteen, twentyEight, ninety, threeSixty, tenEighty, beyond];
60+
61+
print(
62+
'| 1 week | 2 weeks | 1 month | 3 months | 1 year | 3 years | longer |');
63+
print('| --- | --- | --- | --- | --- | --- | --- |');
64+
print('| ${timeData.join(' | ')} |');
65+
print('\n');
66+
67+
var today = DateFormat('MM/dd/yyyy').format(now);
68+
print([today, ...timeData, '' /** empty column */,issueCount, unpriortizedCount].join(', '));
2369
}

tool/triage/lib/github.dart

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,44 +15,6 @@ Future<List<Issue>> getFlutterPluginIssues({Authentication? auth}) async {
1515
}
1616
}
1717

18-
void printCreationTimeCounts(Iterable<Issue> issues) {
19-
var seven = 0;
20-
var fourteen = 0;
21-
var twentyEight = 0;
22-
var ninety = 0;
23-
var threeSixty = 0;
24-
var tenEighty = 0;
25-
var beyond = 0;
26-
27-
var now = DateTime.timestamp();
28-
for (var issue in issues) {
29-
var updated = issue.createdAt!;
30-
var daysSinceUpdate = now.difference(updated).inDays;
31-
switch (daysSinceUpdate) {
32-
case <= 7:
33-
++seven;
34-
case > 7 && <= 14:
35-
++fourteen;
36-
case > 14 && <= 28:
37-
++twentyEight;
38-
case > 28 && <= 90:
39-
++ninety;
40-
case > 90 && <= 360:
41-
++threeSixty;
42-
case > 360 && <= 1080:
43-
++tenEighty;
44-
case _:
45-
++beyond;
46-
}
47-
}
48-
49-
print(
50-
'| 1 week | 2 weeks | 1 month | 3 months | 1 year | 3 years | longer |');
51-
print('| --- | --- | --- | --- | --- | --- | --- |');
52-
print(
53-
'| $seven | $fourteen | $twentyEight | $ninety | $threeSixty | $tenEighty | $beyond |');
54-
}
55-
5618
extension IssueExtension on Issue {
5719
bool get prioritized =>
5820
labels.map((l) => l.name).any((n) => n.startsWith('P'));

tool/triage/pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ environment:
88

99
dependencies:
1010
github: ^9.0.0
11+
intl: ^0.20.0
1112

1213
dev_dependencies:
1314
lints: ^6.0.0

0 commit comments

Comments
 (0)