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