refactor: use new Dart 3.9 analysis options (#3330)

This commit is contained in:
Felix Angelov
2025-09-23 15:15:12 -05:00
committed by GitHub
parent 3e78a18ec9
commit c8bb9e520c
9 changed files with 29 additions and 24 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
include: package:very_good_analysis/analysis_options.9.0.0.yaml
include: package:very_good_analysis/analysis_options.10.0.0.yaml
analyzer:
exclude:
- bin/cache/**
@@ -12,14 +12,16 @@ http.Client retryingHttpClient(http.Client client) => RetryClient(
/// Returns `true` if the [exception] is a retryable exception.
bool isRetryableException(Object exception, StackTrace _) {
return switch (exception.runtimeType) {
const (http.ClientException) => true,
const (HttpException) => true,
const (TlsException) => true,
const (SocketException) => true,
const (WebSocketException) => true,
_ => false,
};
switch (exception) {
case http.ClientException():
case HttpException():
case TlsException():
case SocketException():
case WebSocketException():
return true;
default:
return false;
}
}
/// Returns `true` if the [response] is a retryable response.
@@ -1,3 +1,4 @@
import 'dart:async';
import 'dart:io';
import 'package:archive/archive_io.dart';
@@ -168,7 +169,7 @@ void main() {
() => Cache.shorebirdCacheDirectory,
);
expect(shorebirdCacheDirectory.existsSync(), isFalse);
runWithOverrides(cache.clear);
unawaited(runWithOverrides(cache.clear));
expect(shorebirdCacheDirectory.existsSync(), isFalse);
});
});
@@ -119,8 +119,8 @@ void main() {
when(() => argResults['patch-number']).thenReturn('5');
});
test('should log an error', () {
runWithOverrides(() async {
test('should log an error', () async {
await runWithOverrides(() async {
final result = await command.run();
expect(result, equals(ExitCode.usage.code));
@@ -2728,7 +2728,7 @@ channel: ${DeploymentTrack.staging.channel}
() => process.exitCode,
).thenAnswer((_) async => ExitCode.success.code);
createAabFile(channel: null);
unawaited(createAabFile(channel: null));
});
test('exits with success and calls install and launch app', () async {
@@ -118,11 +118,13 @@ void main() {
).called(1);
});
test('sanitizes executable on windows', () {
test('sanitizes executable on windows', () async {
when(() => platform.isWindows).thenReturn(true);
const executable =
r'C:\Program Files\Android\Android Studio\jbr\bin\java.exe';
runWithOverrides(() => shorebirdProcess.run(executable, ['--version']));
await runWithOverrides(
() => shorebirdProcess.run(executable, ['--version']),
);
verify(
() => processWrapper.run(
'"$executable"',
@@ -490,11 +492,11 @@ void main() {
).called(1);
});
test('sanitizes executable on windows', () {
test('sanitizes executable on windows', () async {
when(() => platform.isWindows).thenReturn(true);
const executable =
r'C:\Program Files\Android\Android Studio\jbr\bin\java.exe';
runWithOverrides(
await runWithOverrides(
() => shorebirdProcess.start(executable, ['--version']),
);
verify(
@@ -146,8 +146,8 @@ class CodePushClient {
'platform': platform.name,
'hash': hash,
'size': '${file.length}',
if (hashSignature != null) 'hash_signature': hashSignature,
if (podfileLockHash != null) 'podfile_lock_hash': podfileLockHash,
'hash_signature': ?hashSignature,
'podfile_lock_hash': ?podfileLockHash,
});
final response = await _httpClient.send(request);
final body = await response.stream.bytesToString();
@@ -301,8 +301,8 @@ class CodePushClient {
body: json.encode({
'version': version,
'flutter_revision': flutterRevision,
if (flutterVersion != null) 'flutter_version': flutterVersion,
if (displayName != null) 'display_name': displayName,
'flutter_version': ?flutterVersion,
'display_name': ?displayName,
}),
);
@@ -445,7 +445,7 @@ class CodePushClient {
final response = await _httpClient.get(
Uri.parse('$_v1/apps/$appId/releases/$releaseId/artifacts').replace(
queryParameters: {
if (arch != null) 'arch': arch,
'arch': ?arch,
if (platform != null) 'platform': platform.name,
},
),
+1 -1
View File
@@ -858,4 +858,4 @@ packages:
source: hosted
version: "2.2.2"
sdks:
dart: ">=3.8.1 <4.0.0"
dart: ">=3.9.0 <4.0.0"
+1 -1
View File
@@ -1,7 +1,7 @@
name: _
publish_to: none
environment:
sdk: ^3.8.0
sdk: ^3.9.0
workspace:
- packages/artifact_proxy
- packages/discord_gcp_alerts