Skip to content

Commit 6fa40b9

Browse files
committed
update to latest SDK
1 parent 69d8720 commit 6fa40b9

File tree

6 files changed

+130
-128
lines changed

6 files changed

+130
-128
lines changed

analysis_options.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ linter:
2222
- prefer_const_declarations
2323
- prefer_expression_function_bodies
2424
- prefer_final_locals
25+
- use_null_aware_elements
2526
- use_string_buffers

lib/redirect.dart

Lines changed: 91 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,20 @@ Iterable<String> get routes => _matchers.keys.map((r) => r.pattern);
3232
final _matchers = <RegExp, Uri Function(Match)>{
3333
// Operations that also work on language repo.
3434
RegExp(r'^/(l(?:anguage)?)$'): (_) => _languageListIssues,
35-
RegExp(r'^/(l(?:anguage)?/)?([0-9]+)$'):
36-
_resolveLastChoose(_showIssue, _languageShowIssue),
35+
RegExp(r'^/(l(?:anguage)?/)?([0-9]+)$'): _resolveLastChoose(
36+
_showIssue,
37+
_languageShowIssue,
38+
),
3739
RegExp(r'^/(l(?:anguage)?/)?new$', caseSensitive: false): (match) =>
3840
match[1] == null ? _newIssue : _languageNewIssue,
39-
RegExp(r'^/(l(?:anguage)?/)?assigned/([A-Za-z0-9\-]+)$'):
40-
_resolveLastChoose(_assignedIssues, _languageAssignedIssues),
41-
RegExp(r'^/(l(?:anguage)?/)?opened/([A-Za-z0-9\-]+)$'):
42-
_resolveLastChoose(_openedIssues, _languageOpenedIssues),
41+
RegExp(r'^/(l(?:anguage)?/)?assigned/([A-Za-z0-9\-]+)$'): _resolveLastChoose(
42+
_assignedIssues,
43+
_languageAssignedIssues,
44+
),
45+
RegExp(r'^/(l(?:anguage)?/)?opened/([A-Za-z0-9\-]+)$'): _resolveLastChoose(
46+
_openedIssues,
47+
_languageOpenedIssues,
48+
),
4349
RegExp(r'^/triage/l(?:anguage)?/?$'): (_) =>
4450
Uri.parse('$_dartBug/triage/language/issues'),
4551
RegExp(r'^/triage/l(?:anguage)?/issues?$'): (_) =>
@@ -70,105 +76,105 @@ final _matchers = <RegExp, Uri Function(Match)>{
7076

7177
// SDK repo only.
7278
RegExp(r'^/area/([A-Za-z0-9\-]+)$'): (match) => _listIssues.replace(
73-
queryParameters: {
74-
'q': [
75-
'label:area-${match[1]}',
76-
].join(' '),
77-
},
78-
),
79+
queryParameters: {
80+
'q': ['label:area-${match[1]}'].join(' '),
81+
},
82+
),
7983

8084
// sdk triage
8185
RegExp(r'^/triage$'): (_) => Uri.parse('$_dartBug/triage/sdk'),
8286
RegExp(r'^/triage/sdk$', caseSensitive: false): (_) => _listIssues.replace(
83-
queryParameters: {
84-
'q': [
85-
'is:issue',
86-
'is:open',
87-
'-label:${_areaLabels.map(_quoteSpaces).join(',')}',
88-
].join(' '),
89-
},
90-
),
87+
queryParameters: {
88+
'q': [
89+
'is:issue',
90+
'is:open',
91+
'-label:${_areaLabels.map(_quoteSpaces).join(',')}',
92+
].join(' '),
93+
},
94+
),
9195

9296
// core packages triage
9397
RegExp(r'^/c(?:ore)?/?$'): (_) => Uri.parse('$gitHub/$organization/core'),
9498
RegExp(r'^/triage/core$'): (_) => Uri.parse('$_dartBug/triage/core/issues'),
9599
// Issues opened in the last 30 days not marked as bugs or enhancements.
96100
RegExp(r'^/triage/core/issues$'): (_) => Uri.parse('$gitHub/issues').replace(
97-
queryParameters: {
98-
'q': [
99-
'is:issue',
100-
'is:open',
101-
'-label:bug,enhancement,type-enhancement,documentation',
102-
'created:>$_dateOneMonth',
103-
..._corePackages.map((repo) => 'repo:$repo'),
104-
].join(' '),
105-
},
106-
),
101+
queryParameters: {
102+
'q': [
103+
'is:issue',
104+
'is:open',
105+
'-label:bug,enhancement,type-enhancement,documentation',
106+
'created:>$_dateOneMonth',
107+
..._corePackages.map((repo) => 'repo:$repo'),
108+
].join(' '),
109+
},
110+
),
107111
// PRs opened in the last 30 days that haven't been assigned a reviewer and
108112
// that aren't draft PRs.
109113
RegExp(r'^/triage/core/prs$'): (_) => Uri.parse('$gitHub/issues').replace(
110-
queryParameters: {
111-
'q': [
112-
'is:pr',
113-
'is:open',
114-
'review:none',
115-
'draft:false',
116-
'created:>$_dateOneMonth',
117-
..._corePackages.map((repo) => 'repo:$repo'),
118-
].join(' '),
119-
},
120-
),
114+
queryParameters: {
115+
'q': [
116+
'is:pr',
117+
'is:open',
118+
'review:none',
119+
'draft:false',
120+
'created:>$_dateOneMonth',
121+
..._corePackages.map((repo) => 'repo:$repo'),
122+
].join(' '),
123+
},
124+
),
121125

122126
RegExp(r'^/t(?:ools)?/?$'): (_) => Uri.parse('$gitHub$organization/tools'),
123127
// tools packages triage
124128
RegExp(r'^/triage/tools$'): (_) => Uri.parse('$_dartBug/triage/tools/issues'),
125129
// Issues opened in the last 30 days not marked as bugs or enhancements.
126130
RegExp(r'^/triage/tools/issues$'): (_) => Uri.parse('$gitHub/issues').replace(
127-
queryParameters: {
128-
'q': [
129-
'is:issue',
130-
'is:open',
131-
'-label:bug,enhancement,type-enhancement,documentation',
132-
'created:>$_dateOneMonth',
133-
..._toolsPackages.map((repo) => 'repo:$repo'),
134-
].join(' '),
135-
},
136-
),
131+
queryParameters: {
132+
'q': [
133+
'is:issue',
134+
'is:open',
135+
'-label:bug,enhancement,type-enhancement,documentation',
136+
'created:>$_dateOneMonth',
137+
..._toolsPackages.map((repo) => 'repo:$repo'),
138+
].join(' '),
139+
},
140+
),
137141
// PRs opened in the last 30 days that haven't been assigned a reviewer and
138142
// that aren't draft PRs.
139143
RegExp(r'^/triage/tools/prs$'): (_) => Uri.parse('$gitHub/issues').replace(
140-
queryParameters: {
141-
'q': [
142-
'is:pr',
143-
'is:open',
144-
'review:none',
145-
'draft:false',
146-
'created:>$_dateOneMonth',
147-
..._toolsPackages.map((repo) => 'repo:$repo'),
148-
].join(' '),
149-
},
150-
),
144+
queryParameters: {
145+
'q': [
146+
'is:pr',
147+
'is:open',
148+
'review:none',
149+
'draft:false',
150+
'created:>$_dateOneMonth',
151+
..._toolsPackages.map((repo) => 'repo:$repo'),
152+
].join(' '),
153+
},
154+
),
151155
};
152156

153157
/// Resolves one of [base1] or [base2] against the last capture of `match`.
154158
///
155159
/// Chooses [base1] if the first capture (`match[1]`) is `null`,
156160
/// and [base2] otherwise.
157161
/// (The former is an SDK repo base, the latter a language repo base.)
158-
Uri Function(Match) _resolveLastChoose(Uri base1, Uri base2) => (Match match) =>
159-
((match[1] == null) ? base1 : base2).resolve(match[match.groupCount]!);
162+
Uri Function(Match) _resolveLastChoose(Uri base1, Uri base2) =>
163+
(Match match) =>
164+
((match[1] == null) ? base1 : base2).resolve(match[match.groupCount]!);
160165

161166
final List<String> _areaLabels = [
162-
for (var (label as String) in jsonDecode(
163-
File('static/sdk_labels.json').readAsStringSync(),
164-
) as List)
165-
if (label.startsWith('area-') || label.startsWith('legacy-area-')) label
167+
for (var (label as String)
168+
in jsonDecode(File('static/sdk_labels.json').readAsStringSync()) as List)
169+
if (label.startsWith('area-') || label.startsWith('legacy-area-')) label,
166170
];
167171

168-
final List<String> _corePackages =
169-
_parsePackageInfo(File('static/core_packages.csv'));
170-
final List<String> _toolsPackages =
171-
_parsePackageInfo(File('static/tools_packages.csv'));
172+
final List<String> _corePackages = _parsePackageInfo(
173+
File('static/core_packages.csv'),
174+
);
175+
final List<String> _toolsPackages = _parsePackageInfo(
176+
File('static/tools_packages.csv'),
177+
);
172178

173179
/// Find the redirect for the supplied [requestUri].
174180
///
@@ -191,18 +197,19 @@ Uri? findRedirect(Uri requestUri) {
191197

192198
/// Parse a csv file with package information; return a list of repositories
193199
/// that we're interested in triaging.
194-
List<String> _parsePackageInfo(File file) => file
195-
.readAsLinesSync()
196-
.where((line) => line.isNotEmpty && !line.startsWith('#'))
197-
.map((String line) {
198-
// "args,dart-lang/args,dart.dev"
199-
final info = line.split(',');
200-
return info[1];
201-
})
202-
.where((repo) => repo != 'dart-lang/sdk')
203-
.toSet()
204-
.toList()
205-
..sort();
200+
List<String> _parsePackageInfo(File file) =>
201+
file
202+
.readAsLinesSync()
203+
.where((line) => line.isNotEmpty && !line.startsWith('#'))
204+
.map((String line) {
205+
// "args,dart-lang/args,dart.dev"
206+
final info = line.split(',');
207+
return info[1];
208+
})
209+
.where((repo) => repo != 'dart-lang/sdk')
210+
.toSet()
211+
.toList()
212+
..sort();
206213

207214
/// Return the current date, less ~1 month, in '2022-01-15' format.
208215
String get _dateOneMonth {

lib/server.dart

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,10 @@ Response _handler(Request request) {
3434
switch (request.requestedUri.pathSegments.single) {
3535
case 'robots.txt':
3636
_robotTxt++;
37-
return Response.ok(
38-
r'''
37+
return Response.ok(r'''
3938
User-agent: *
4039
Allow: /
41-
''',
42-
);
40+
''');
4341
case '\$info':
4442
_infoRequests++;
4543

@@ -52,10 +50,14 @@ Allow: /
5250
'robot.txt': _robotTxt,
5351
},
5452
'Dart version': Platform.version,
55-
'request headers':
56-
SplayTreeMap.of(request.headers, compareAsciiLowerCase),
57-
'Environment':
58-
SplayTreeMap.of(Platform.environment, compareAsciiLowerCase),
53+
'request headers': SplayTreeMap.of(
54+
request.headers,
55+
compareAsciiLowerCase,
56+
),
57+
'Environment': SplayTreeMap.of(
58+
Platform.environment,
59+
compareAsciiLowerCase,
60+
),
5961
'agents': _agents,
6062
};
6163

@@ -78,16 +80,13 @@ Allow: /
7880
return Response.found(location);
7981
} else {
8082
_notFound++;
81-
throw BadRequestException(
82-
404,
83-
"""
83+
throw BadRequestException(404, """
8484
I don't support redirecting path '${request.requestedUri.path}'
8585
8686
Check out my source at https://github.com/dart-lang/dartbug.com
8787
8888
Supported routes:
8989
${routes.map((r) => ' $r').join('\n')}
90-
""",
91-
);
90+
""");
9291
}
9392
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: dartbug
22
publish_to: none
33

44
environment:
5-
sdk: ^3.5.0
5+
sdk: ^3.8.0
66

77
dependencies:
88
collection: ^1.19.1

0 commit comments

Comments
 (0)