Skip to content

Commit 100b9d4

Browse files
ci: make the Android gate pass what it actually checks
Three things the gate caught that local runs had not: `dart format` walks into mobile/build and dies on Gradle's intermediates, so the CI step now names lib, test and packages explicitly rather than `.`. It has no ignore file of its own. Reformatting broke two suppressions. `// ignore: deprecated_member_use` attaches to the following line, and the formatter reflowed `import ... show CorePalette;` across four lines, leaving the comment pointing at nothing. Importing material_color_utilities without a `show` clause removes the deprecated-member reference from the import site entirely; the per-usage ignores were already correct and still apply. CorePalette stays because it is what dynamic_color returns on Android. A brace-less `if` body in the v2ray-plugin branch of the shadowsocks converter tripped curly_braces_in_flow_control_structures under --fatal-infos. Verified locally with the exact CI command set: dart format clean, flutter analyze --fatal-infos clean, 731 + 145 + 100 tests, APK builds.
1 parent dda603a commit 100b9d4

84 files changed

Lines changed: 1552 additions & 1395 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/android.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ jobs:
125125

126126
- name: Check formatting
127127
working-directory: mobile
128-
run: dart format --output=none --set-exit-if-changed .
128+
# Explicit source roots, not `.`: dart format has no ignore file and walks into
129+
# build/ and .dart_tool/, where it trips over Gradle's intermediates.
130+
run: dart format --output=none --set-exit-if-changed lib test packages
129131

130132
- name: Analyse
131133
working-directory: mobile

mobile/lib/features/connections/connection_detail_sheet.dart

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ class ConnectionDetailSheet extends ConsumerWidget {
107107
),
108108
ConnectionDetailRow(
109109
label: l10n.t('connections.detail.establishTime'),
110-
value: '${formatTimestamp(connection.start)} '
110+
value:
111+
'${formatTimestamp(connection.start)} '
111112
'(${formatElapsedClock(DateTime.now().difference(connection.start))})',
112113
),
113114
if (fields.rule.isNotEmpty)
@@ -244,11 +245,8 @@ class ConnectionDetailRow extends StatelessWidget {
244245
? PopupMenuButton<String>(
245246
tooltip: l10n.t('connections.detail.copyRule'),
246247
icon: const Icon(Icons.copy_rounded, size: 18),
247-
onSelected: (String text) => _copy(
248-
context,
249-
text,
250-
isRule: text != value,
251-
),
248+
onSelected: (String text) =>
249+
_copy(context, text, isRule: text != value),
252250
itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
253251
for (final ClashRuleCandidate candidate in candidates)
254252
PopupMenuItem<String>(
@@ -304,11 +302,7 @@ class ConnectionDetailRow extends StatelessWidget {
304302
);
305303
}
306304

307-
static void _copy(
308-
BuildContext context,
309-
String text, {
310-
required bool isRule,
311-
}) {
305+
static void _copy(BuildContext context, String text, {required bool isRule}) {
312306
final AikoL10n l10n = context.l10n;
313307
// Fire and forget: the platform side of setData cannot fail in a way the
314308
// user could act on, and blocking the menu dismissal on it would be worse.
-6 Bytes
Binary file not shown.

mobile/lib/features/connections/connections_controller.dart

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,7 @@ class ConnectionsFeedNotifier extends Notifier<ConnectionsFeedState> {
137137
}
138138

139139
static List<ConnectionInfo> _trim(List<ConnectionInfo> items, int limit) =>
140-
items.length > limit
141-
? items.sublist(items.length - limit)
142-
: items;
140+
items.length > limit ? items.sublist(items.length - limit) : items;
143141

144142
/// Folds one `/connections` frame into the feed.
145143
///
@@ -211,9 +209,7 @@ class ConnectionsFeedNotifier extends Notifier<ConnectionsFeedState> {
211209
if (state.paused == paused) return;
212210
state = state.copyWith(paused: paused);
213211
if (!paused) {
214-
ref
215-
.read(connectionsSnapshotProvider)
216-
.whenOrNull<void>(data: ingest);
212+
ref.read(connectionsSnapshotProvider).whenOrNull<void>(data: ingest);
217213
}
218214
}
219215

mobile/lib/features/connections/connections_page.dart

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,7 @@ class _ConnectionsPageState extends ConsumerState<ConnectionsPage>
113113
mainAxisSize: MainAxisSize.min,
114114
children: <Widget>[
115115
Padding(
116-
padding: const EdgeInsets.fromLTRB(
117-
AikoDims.pagePadding,
118-
0,
119-
8,
120-
8,
121-
),
116+
padding: const EdgeInsets.fromLTRB(AikoDims.pagePadding, 0, 8, 8),
122117
child: Row(
123118
children: <Widget>[
124119
Expanded(
@@ -164,8 +159,8 @@ class _ConnectionsPageState extends ConsumerState<ConnectionsPage>
164159
color: theme.colorScheme.error,
165160
onPressed:
166161
(_tab == ConnectionsTab.active
167-
? visibleActive
168-
: visibleClosed)
162+
? visibleActive
163+
: visibleClosed)
169164
.isEmpty
170165
? null
171166
: () => _closeVisible(
@@ -262,13 +257,13 @@ class _ConnectionsPageState extends ConsumerState<ConnectionsPage>
262257
if (!confirmed || !mounted) return;
263258

264259
if (_tab == ConnectionsTab.closed) {
265-
ref.read(connectionsFeedProvider.notifier).clearClosed(
266-
ids: _query.isEmpty
267-
? null
268-
: <String>{
269-
for (final ConnectionInfo item in visible) item.id,
270-
},
271-
);
260+
ref
261+
.read(connectionsFeedProvider.notifier)
262+
.clearClosed(
263+
ids: _query.isEmpty
264+
? null
265+
: <String>{for (final ConnectionInfo item in visible) item.id},
266+
);
272267
return;
273268
}
274269

@@ -356,9 +351,7 @@ class _TotalsBar extends StatelessWidget {
356351
),
357352
child: Row(
358353
mainAxisAlignment: MainAxisAlignment.end,
359-
children: <Widget>[
360-
ConnectionTrafficPill(up: upload, down: download),
361-
],
354+
children: <Widget>[ConnectionTrafficPill(up: upload, down: download)],
362355
),
363356
);
364357
}
@@ -448,9 +441,7 @@ class _SortMenu extends ConsumerWidget {
448441
tooltip: l10n.t('connections.orderBy'),
449442
icon: const Icon(Icons.sort_rounded),
450443
onSelected: (String value) async {
451-
final AppConfigNotifier notifier = ref.read(
452-
appConfigProvider.notifier,
453-
);
444+
final AppConfigNotifier notifier = ref.read(appConfigProvider.notifier);
454445
final ScaffoldMessengerState? messenger = ScaffoldMessenger.maybeOf(
455446
context,
456447
);

mobile/lib/features/connections/format.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ TrafficAmount splitTraffic(int bytes) {
5757
value /= 1024;
5858
unit++;
5959
}
60-
return (value: formatTrafficMagnitude(value), unitKey: kTrafficUnitKeys[unit]);
60+
return (
61+
value: formatTrafficMagnitude(value),
62+
unitKey: kTrafficUnitKeys[unit],
63+
);
6164
}
6265

6366
/// `"1.20 MB"`[splitTraffic] with its unit key resolved.

mobile/lib/features/logs/logs_controller.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,7 @@ final Provider<List<LogLine>> visibleLogsProvider = Provider<List<LogLine>>((
160160
final List<LogLine> out = <LogLine>[];
161161
for (int i = source.length - 1; i >= start; i--) {
162162
final LogLine line = source[i];
163-
if (logPassesLevel(line, view.level) &&
164-
logMatchesQuery(line, view.query)) {
163+
if (logPassesLevel(line, view.level) && logMatchesQuery(line, view.query)) {
165164
out.add(line);
166165
}
167166
}

mobile/lib/features/logs/logs_page.dart

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,7 @@ class _LevelMenu extends ConsumerWidget {
240240
),
241241
onSelected: (String value) => ref
242242
.read(logsViewProvider.notifier)
243-
.setLevel(
244-
value == _allValue ? null : LogLevel.fromWire(value),
245-
),
243+
.setLevel(value == _allValue ? null : LogLevel.fromWire(value)),
246244
itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
247245
CheckedPopupMenuItem<String>(
248246
value: _allValue,
@@ -324,9 +322,10 @@ class _LogsMenu extends StatelessWidget {
324322
PopupMenuItem<String>(
325323
enabled: false,
326324
child: Text(
327-
l10n.t('logs.bufferHint', args: <String, Object?>{
328-
'count': kLogsViewLineLimit,
329-
}),
325+
l10n.t(
326+
'logs.bufferHint',
327+
args: <String, Object?>{'count': kLogsViewLineLimit},
328+
),
330329
style: Theme.of(context).textTheme.bodySmall,
331330
),
332331
),

mobile/lib/features/profiles/data/deep_merge.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,13 @@ Map<String, dynamic> _asStringMap(Map<dynamic, dynamic> value) =>
9797
for (final entry in value.entries) entry.key.toString(): entry.value,
9898
};
9999

100-
Map<String, dynamic> _cloneMap(Map<String, dynamic> value) =>
101-
<String, dynamic>{
102-
for (final entry in value.entries) entry.key: _cloneValue(entry.value),
103-
};
100+
Map<String, dynamic> _cloneMap(Map<String, dynamic> value) => <String, dynamic>{
101+
for (final entry in value.entries) entry.key: _cloneValue(entry.value),
102+
};
104103

105-
List<dynamic> _cloneList(List<dynamic> value) =>
106-
<dynamic>[for (final entry in value) _cloneValue(entry)];
104+
List<dynamic> _cloneList(List<dynamic> value) => <dynamic>[
105+
for (final entry in value) _cloneValue(entry),
106+
];
107107

108108
Object? _cloneValue(Object? value) {
109109
if (value is Map) return _cloneMap(_asStringMap(value));

mobile/lib/features/profiles/data/profile_error_text.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ class ProfileErrorText {
3737
/// [redactUrl]. Deliberately greedy about what counts as a URL — a false
3838
/// positive costs a redacted word, a false negative leaks a token.
3939
final RegExp _urlLike = RegExp(
40-
r'[a-zA-Z][a-zA-Z0-9+.-]*://[^\s<>"' r"'" r']+',
40+
r'[a-zA-Z][a-zA-Z0-9+.-]*://[^\s<>"'
41+
r"'"
42+
r']+',
4143
);
4244

4345
/// Replaces every URL in [text] with its redacted form.
@@ -108,8 +110,8 @@ String describeBatchFailure(AikoL10n l10n, ProfileBatchFailure failure) {
108110
ProfileBatchFailureKind.notFound => l10n.t(
109111
'error.code.E_PROFILE_NOT_FOUND',
110112
),
111-
ProfileBatchFailureKind.network || ProfileBatchFailureKind.backoff => l10n
112-
.t('error.code.E_SUBSCRIPTION_FETCH_FAILED'),
113+
ProfileBatchFailureKind.network || ProfileBatchFailureKind.backoff =>
114+
l10n.t('error.code.E_SUBSCRIPTION_FETCH_FAILED'),
113115
ProfileBatchFailureKind.invalidContent => l10n.t(
114116
'error.code.E_SUBSCRIPTION_INVALID',
115117
),
@@ -133,8 +135,7 @@ String _subscriptionKey(SubscriptionErrorCode code) => switch (code) {
133135
SubscriptionErrorCode.htmlResponse ||
134136
SubscriptionErrorCode.emptyResponse ||
135137
SubscriptionErrorCode.unusableContent ||
136-
SubscriptionErrorCode.outOfBounds =>
137-
'error.code.E_SUBSCRIPTION_INVALID',
138+
SubscriptionErrorCode.outOfBounds => 'error.code.E_SUBSCRIPTION_INVALID',
138139
};
139140

140141
String _rawMessage(Object error) => switch (error) {

0 commit comments

Comments
 (0)