Skip to content

Commit ae0b7df

Browse files
committed
refactor(dart_frog_cli): upgrade analysis options
1 parent 0249bd9 commit ae0b7df

File tree

18 files changed

+64
-35
lines changed

18 files changed

+64
-35
lines changed
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
include: package:very_good_analysis/analysis_options.6.0.0.yaml
1+
include: package:very_good_analysis/analysis_options.yaml
22
analyzer:
33
exclude:
44
- lib/src/version.dart
5+
linter:
6+
rules:
7+
# Experimental and there are lots of false positives
8+
specify_nonobvious_property_types: false

packages/dart_frog_cli/e2e/test/dev_test.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,17 @@ void main() {
8484
});
8585

8686
fail('exception not thrown');
87-
} catch (e) {
88-
expect(e.toString(), contains('Could not start the VM service:'));
87+
} on String catch (e) {
88+
expect(e, contains('Could not start the VM service:'));
8989

9090
expect(
91-
e.toString(),
91+
e,
9292
contains(
9393
'DartDevelopmentServiceException: Failed to create server socket',
9494
),
9595
);
9696

97-
expect(e.toString(), contains('127.0.0.1:8181'));
97+
expect(e, contains('127.0.0.1:8181'));
9898
}
9999
},
100100
);
@@ -131,6 +131,6 @@ extension<T> on Future<T> {
131131
Future<void> ignoreErrors() async {
132132
try {
133133
await this;
134-
} catch (_) {}
134+
} on Exception catch (_) {}
135135
}
136136
}

packages/dart_frog_cli/lib/dart_frog_cli.dart

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/dart_frog_cli/lib/src/command_runner.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class DartFrogCommandRunner extends CompletionCommandRunner<int> {
7373
late final int exitCode;
7474
try {
7575
exitCode = await runCommand(argResults) ?? ExitCode.success.code;
76-
} catch (error) {
76+
} on Exception catch (error) {
7777
_logger.err('$error');
7878
exitCode = ExitCode.software.code;
7979
}
@@ -123,7 +123,7 @@ ${lightYellow.wrap('Changelog:')} $changelogLink
123123
Run ${lightCyan.wrap('$executableName update')} to update''',
124124
);
125125
}
126-
} catch (error, stackTrace) {
126+
} on Exception catch (error, stackTrace) {
127127
_logger.detail(
128128
'[updater] update check error.\n$error\n$stackTrace',
129129
);

packages/dart_frog_cli/lib/src/commands/build/build.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class BuildCommand extends DartFrogCommand {
4949

5050
try {
5151
return (await builder.build()).code;
52-
} catch (e) {
52+
} on Exception catch (e) {
5353
logger.err(e.toString());
5454
return ExitCode.software.code;
5555
}

packages/dart_frog_cli/lib/src/commands/dev/dev.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class DevCommand extends DartFrogCommand {
133133
try {
134134
await _devServerRunner.start(results.rest);
135135
return (await _devServerRunner.exitCode).code;
136-
} catch (e) {
136+
} on Exception catch (e) {
137137
logger.err(e.toString());
138138
return ExitCode.software.code;
139139
} finally {

packages/dart_frog_cli/lib/src/commands/new/new.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,12 @@ class _NewSubCommand extends DartFrogCommand {
6262

6363
@visibleForTesting
6464
@override
65+
// ignoring for testing purposes
6566
// ignore: invalid_use_of_visible_for_testing_member
6667
ArgResults? get testArgResults => parent.testArgResults;
6768

6869
@override
70+
// ignoring for testing purposes
6971
// ignore: invalid_use_of_visible_for_testing_member
7072
String? get testUsage => parent.testUsage;
7173

packages/dart_frog_cli/lib/src/commands/update/update.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class UpdateCommand extends DartFrogCommand {
4343
late final String latestVersion;
4444
try {
4545
latestVersion = await _pubUpdater.getLatestVersion(packageName);
46-
} catch (error) {
46+
} on Exception catch (error) {
4747
updateCheckProgress.fail();
4848
_logger.err('$error');
4949
return ExitCode.software.code;
@@ -70,7 +70,7 @@ class UpdateCommand extends DartFrogCommand {
7070
packageName: packageName,
7171
versionConstraint: latestVersion,
7272
);
73-
} catch (error) {
73+
} on Exception catch (error) {
7474
updateProgress.fail();
7575
_logger.err('$error');
7676
return ExitCode.software.code;

packages/dart_frog_cli/lib/src/daemon/domain/dev_server_domain.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ class DevServerDomain extends DomainBase {
115115
'applicationId': applicationId,
116116
},
117117
);
118+
// ignoring for backward compatibility
119+
// ignore: avoid_catches_without_on_clauses
118120
} catch (e) {
119121
return DaemonResponse.error(
120122
id: request.id,
@@ -149,6 +151,8 @@ class DevServerDomain extends DomainBase {
149151
'applicationId': applicationId,
150152
},
151153
);
154+
// ignoring for backward compatibility
155+
// ignore: avoid_catches_without_on_clauses
152156
} catch (e) {
153157
return DaemonResponse.error(
154158
id: request.id,
@@ -186,6 +190,8 @@ class DevServerDomain extends DomainBase {
186190
'exitCode': exitCode.code,
187191
},
188192
);
193+
// ignoring for backward compatibility
194+
// ignore: avoid_catches_without_on_clauses
189195
} catch (e) {
190196
if (!runner.isCompleted) {
191197
_devServerRunners[applicationId] = runner;

packages/dart_frog_cli/lib/src/daemon/domain/route_configuration_domain.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ class RouteConfigurationDomain extends DomainBase {
8383
},
8484
),
8585
);
86+
// ignoring for backward compatibility
87+
// ignore: avoid_catches_without_on_clauses
8688
} catch (e) {
8789
return DaemonResponse.error(
8890
id: request.id,
@@ -183,6 +185,8 @@ class RouteConfigurationDomain extends DomainBase {
183185
'exitCode': exitCode.code,
184186
},
185187
);
188+
// ignoring for backward compatibility
189+
// ignore: avoid_catches_without_on_clauses
186190
} catch (e) {
187191
if (!watcher.isCompleted) {
188192
_routeConfigurationWatchers[watcherId] = watcher;

0 commit comments

Comments
 (0)