From 9a8fef21bced8d6f3249acc2bd3297149dea8690 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Dec 2024 09:16:18 +0000 Subject: [PATCH 1/5] chore(deps): bump very_good_analysis from 6.0.0 to 7.0.0 Bumps [very_good_analysis](https://github.com/VeryGoodOpenSource/very_good_analysis) from 6.0.0 to 7.0.0. - [Release notes](https://github.com/VeryGoodOpenSource/very_good_analysis/releases) - [Changelog](https://github.com/VeryGoodOpenSource/very_good_analysis/blob/main/CHANGELOG.md) - [Commits](https://github.com/VeryGoodOpenSource/very_good_analysis/compare/v6.0.0...v7.0.0) --- updated-dependencies: - dependency-name: very_good_analysis dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 726d72d1..ae853503 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -36,7 +36,7 @@ dev_dependencies: build_version: ^2.1.1 mocktail: ^1.0.4 test: ^1.25.8 - very_good_analysis: ^6.0.0 + very_good_analysis: ">=6.0.0 <8.0.0" executables: very_good: From 2acece7e69e6bcb0a252044046762a641889f38e Mon Sep 17 00:00:00 2001 From: Tom Arra Date: Fri, 20 Dec 2024 09:09:37 -0600 Subject: [PATCH 2/5] analysis updates and fixes --- analysis_options.yaml | 2 +- lib/src/cli/dart_cli.dart | 2 +- lib/src/cli/flutter_cli.dart | 2 +- lib/src/cli/git_cli.dart | 2 +- lib/src/command_runner.dart | 2 +- lib/src/commands/create/commands/create_subcommand.dart | 2 +- .../packages/commands/check/commands/licenses.dart | 6 +++--- lib/src/commands/packages/commands/get.dart | 2 +- lib/src/commands/test/test.dart | 2 +- lib/src/commands/update.dart | 4 ++-- lib/src/pubspec_lock/pubspec_lock.dart | 6 +++--- lib/very_good_cli.dart | 2 +- pubspec.yaml | 2 +- test/ensure_build_test.dart | 2 +- test/helpers/command_helper.dart | 4 ++-- test/src/command_runner_test.dart | 4 ++-- test/src/commands/create/commands/dart_cli_test.dart | 4 ++-- test/src/commands/create/commands/dart_package_test.dart | 4 ++-- test/src/commands/create/commands/docs_site_test.dart | 4 ++-- test/src/commands/create/commands/flame_game_test.dart | 8 ++++---- test/src/commands/create/commands/flutter_app_test.dart | 8 ++++---- .../commands/create/commands/flutter_package_test.dart | 4 ++-- .../src/commands/create/commands/flutter_plugin_test.dart | 4 ++-- test/src/commands/create/create_subcommand_test.dart | 4 ++-- 24 files changed, 43 insertions(+), 43 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index 646bccec..3477486a 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,4 +1,4 @@ -include: package:very_good_analysis/analysis_options.5.1.0.yaml +include: package:very_good_analysis/analysis_options.7.0.0.yaml analyzer: exclude: - "**/version.dart" diff --git a/lib/src/cli/dart_cli.dart b/lib/src/cli/dart_cli.dart index 12940b9a..ae9b290a 100644 --- a/lib/src/cli/dart_cli.dart +++ b/lib/src/cli/dart_cli.dart @@ -9,7 +9,7 @@ class Dart { try { await _Cmd.run('dart', ['--version'], logger: logger); return true; - } catch (_) { + } on Exception catch (_) { return false; } } diff --git a/lib/src/cli/flutter_cli.dart b/lib/src/cli/flutter_cli.dart index 7a9b5ae1..9b136ae2 100644 --- a/lib/src/cli/flutter_cli.dart +++ b/lib/src/cli/flutter_cli.dart @@ -124,7 +124,7 @@ class Flutter { try { await _Cmd.run('flutter', ['--version'], logger: logger); return true; - } catch (_) { + } on Exception catch (_) { return false; } } diff --git a/lib/src/cli/git_cli.dart b/lib/src/cli/git_cli.dart index e5df0631..2339a45a 100644 --- a/lib/src/cli/git_cli.dart +++ b/lib/src/cli/git_cli.dart @@ -31,7 +31,7 @@ class Git { ['ls-remote', '$remote', '--exit-code'], logger: logger, ); - } catch (_) { + } on Exception catch (_) { throw UnreachableGitDependency(remote: remote); } } diff --git a/lib/src/command_runner.dart b/lib/src/command_runner.dart index b9e6dbcf..91d20ab4 100644 --- a/lib/src/command_runner.dart +++ b/lib/src/command_runner.dart @@ -146,7 +146,7 @@ ${lightYellow.wrap('Changelog:')} ${lightCyan.wrap('https://github.com/verygoodo Run ${lightCyan.wrap('very_good update')} to update''', ); } - } catch (_) {} + } on Exception catch (_) {} } void _showThankYou() { diff --git a/lib/src/commands/create/commands/create_subcommand.dart b/lib/src/commands/create/commands/create_subcommand.dart index 969a52be..42137308 100644 --- a/lib/src/commands/create/commands/create_subcommand.dart +++ b/lib/src/commands/create/commands/create_subcommand.dart @@ -178,7 +178,7 @@ abstract class CreateSubCommand extends Command { '''Building generator from brick: ${brick.name} ${brick.location.version}''', ); return await _generatorFromBrick(brick); - } catch (error) { + } on Exception catch (error) { logger.detail('Building generator from brick failed: $error'); } logger.detail( diff --git a/lib/src/commands/packages/commands/check/commands/licenses.dart b/lib/src/commands/packages/commands/check/commands/licenses.dart index d66d6eba..ff6b7ad3 100644 --- a/lib/src/commands/packages/commands/check/commands/licenses.dart +++ b/lib/src/commands/packages/commands/check/commands/licenses.dart @@ -269,7 +269,7 @@ class PackagesCheckLicensesCommand extends Command { try { detectorResult = await detectLicense(licenseFileContent, _defaultDetectionThreshold); - } catch (e) { + } on Exception catch (e) { final errorMessage = '''[$dependencyName] Failed to detect license from $packagePath: $e'''; if (!ignoreFailures) { @@ -330,7 +330,7 @@ PubspecLock? _tryParsePubspecLock(File pubspecLockFile) { final content = pubspecLockFile.readAsStringSync(); try { return PubspecLock.fromString(content); - } catch (_) {} + } on Exception catch (_) {} } return null; @@ -348,7 +348,7 @@ Future _tryFindPackageConfig( final findPackageConfig = findPackageConfigOverride ?? package_config.findPackageConfig; return await findPackageConfig(directory); - } catch (error) { + } on Exception { return null; } } diff --git a/lib/src/commands/packages/commands/get.dart b/lib/src/commands/packages/commands/get.dart index 7c4f0053..e0855ac3 100644 --- a/lib/src/commands/packages/commands/get.dart +++ b/lib/src/commands/packages/commands/get.dart @@ -61,7 +61,7 @@ class PackagesGetCommand extends Command { } on PubspecNotFound catch (_) { _logger.err('Could not find a pubspec.yaml in $targetPath'); return ExitCode.noInput.code; - } catch (error) { + } on Exception catch (error) { _logger.err('$error'); return ExitCode.unavailable.code; } diff --git a/lib/src/commands/test/test.dart b/lib/src/commands/test/test.dart index 634d7568..342cf2c9 100644 --- a/lib/src/commands/test/test.dart +++ b/lib/src/commands/test/test.dart @@ -229,7 +229,7 @@ This command should be run from the root of your Flutter project.''', '''Expected coverage >= ${minCoverage.toStringAsFixed(decimalPlaces)}% but actual is ${e.coverage.toStringAsFixed(decimalPlaces)}%.''', ); return ExitCode.unavailable.code; - } catch (error) { + } on Exception catch (error) { _logger.err('$error'); return ExitCode.unavailable.code; } diff --git a/lib/src/commands/update.dart b/lib/src/commands/update.dart index dbce0207..7926ad52 100644 --- a/lib/src/commands/update.dart +++ b/lib/src/commands/update.dart @@ -35,7 +35,7 @@ class UpdateCommand extends Command { late final String latestVersion; try { latestVersion = await _pubUpdater.getLatestVersion(packageName); - } catch (error) { + } on Exception catch (error) { updateCheckProgress.fail(); _logger.err('$error'); return ExitCode.software.code; @@ -57,7 +57,7 @@ class UpdateCommand extends Command { packageName: packageName, versionConstraint: latestVersion, ); - } catch (error) { + } on Exception catch (error) { updateProgress.fail(); _logger.err('$error'); return ExitCode.software.code; diff --git a/lib/src/pubspec_lock/pubspec_lock.dart b/lib/src/pubspec_lock/pubspec_lock.dart index 2120a067..d2c2ce10 100644 --- a/lib/src/pubspec_lock/pubspec_lock.dart +++ b/lib/src/pubspec_lock/pubspec_lock.dart @@ -4,7 +4,7 @@ /// source of the dependencies to analyze. Hence, it is not a complete parser, /// it only parses the information that is needed for the /// `packages check license` command. -library pubspec_lock; +library; import 'dart:collection'; @@ -38,7 +38,7 @@ class PubspecLock { late final YamlMap yaml; try { yaml = loadYaml(content) as YamlMap; - } catch (_) { + } on Exception catch (_) { throw const PubspecLockParseException(); } @@ -56,7 +56,7 @@ class PubspecLock { data: entry.value as YamlMap, ); parsedPackages.add(package); - } catch (_) { + } on Exception catch (_) { // Ignore those packages that for some reason cannot be parsed. } } diff --git a/lib/very_good_cli.dart b/lib/very_good_cli.dart index bc8f2784..42ed941c 100644 --- a/lib/very_good_cli.dart +++ b/lib/very_good_cli.dart @@ -7,4 +7,4 @@ /// # see usage /// very_good --help /// ``` -library very_good_cli; +library; diff --git a/pubspec.yaml b/pubspec.yaml index ae853503..fd78f02c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -36,7 +36,7 @@ dev_dependencies: build_version: ^2.1.1 mocktail: ^1.0.4 test: ^1.25.8 - very_good_analysis: ">=6.0.0 <8.0.0" + very_good_analysis: ^7.0.0 executables: very_good: diff --git a/test/ensure_build_test.dart b/test/ensure_build_test.dart index dca607a8..8627c296 100644 --- a/test/ensure_build_test.dart +++ b/test/ensure_build_test.dart @@ -1,5 +1,5 @@ @Tags(['pull-request-only']) -library ensure_build_test; +library; import 'package:build_verify/build_verify.dart'; import 'package:test/test.dart'; diff --git a/test/helpers/command_helper.dart b/test/helpers/command_helper.dart index 3920f25f..e3cee8c1 100644 --- a/test/helpers/command_helper.dart +++ b/test/helpers/command_helper.dart @@ -45,8 +45,8 @@ void Function() withRunner( environment: {'CI': 'true'}, ); - when(() => progress.complete(any())).thenAnswer((_) { - final message = _.positionalArguments.elementAt(0) as String?; + when(() => progress.complete(any())).thenAnswer((a) { + final message = a.positionalArguments.elementAt(0) as String?; if (message != null) progressLogs.add(message); }); when(() => logger.progress(any())).thenReturn(progress); diff --git a/test/src/command_runner_test.dart b/test/src/command_runner_test.dart index 5c207b38..d96af834 100644 --- a/test/src/command_runner_test.dart +++ b/test/src/command_runner_test.dart @@ -116,8 +116,8 @@ void main() { ).thenAnswer((_) => Future.value(true)); final progress = _MockProgress(); final progressLogs = []; - when(() => progress.complete(any())).thenAnswer((_) { - final message = _.positionalArguments.elementAt(0) as String?; + when(() => progress.complete(any())).thenAnswer((a) { + final message = a.positionalArguments.elementAt(0) as String?; if (message != null) progressLogs.add(message); }); when(() => logger.progress(any())).thenReturn(progress); diff --git a/test/src/commands/create/commands/dart_cli_test.dart b/test/src/commands/create/commands/dart_cli_test.dart index e552fa79..52684a80 100644 --- a/test/src/commands/create/commands/dart_cli_test.dart +++ b/test/src/commands/create/commands/dart_cli_test.dart @@ -143,9 +143,9 @@ void main() { vars: any(named: 'vars'), logger: any(named: 'logger'), ), - ).thenAnswer((_) async { + ).thenAnswer((a) async { final target = - _.positionalArguments.first as DirectoryGeneratorTarget; + a.positionalArguments.first as DirectoryGeneratorTarget; File(path.join(target.dir.path, 'my_cli', 'pubspec.yaml')) ..createSync(recursive: true) ..writeAsStringSync(pubspec); diff --git a/test/src/commands/create/commands/dart_package_test.dart b/test/src/commands/create/commands/dart_package_test.dart index 8bb6ec39..f31ebc2c 100644 --- a/test/src/commands/create/commands/dart_package_test.dart +++ b/test/src/commands/create/commands/dart_package_test.dart @@ -143,9 +143,9 @@ void main() { vars: any(named: 'vars'), logger: any(named: 'logger'), ), - ).thenAnswer((_) async { + ).thenAnswer((a) async { final target = - _.positionalArguments.first as DirectoryGeneratorTarget; + a.positionalArguments.first as DirectoryGeneratorTarget; File(path.join(target.dir.path, 'my_package', 'pubspec.yaml')) ..createSync(recursive: true) ..writeAsStringSync(pubspec); diff --git a/test/src/commands/create/commands/docs_site_test.dart b/test/src/commands/create/commands/docs_site_test.dart index b3ba0bd8..d15b8b15 100644 --- a/test/src/commands/create/commands/docs_site_test.dart +++ b/test/src/commands/create/commands/docs_site_test.dart @@ -142,9 +142,9 @@ void main() { vars: any(named: 'vars'), logger: any(named: 'logger'), ), - ).thenAnswer((_) async { + ).thenAnswer((a) async { final target = - _.positionalArguments.first as DirectoryGeneratorTarget; + a.positionalArguments.first as DirectoryGeneratorTarget; File(path.join(target.dir.path, 'my_docs_site', 'pubspec.yaml')) ..createSync(recursive: true) ..writeAsStringSync(pubspec); diff --git a/test/src/commands/create/commands/flame_game_test.dart b/test/src/commands/create/commands/flame_game_test.dart index 8bebfab2..8559e833 100644 --- a/test/src/commands/create/commands/flame_game_test.dart +++ b/test/src/commands/create/commands/flame_game_test.dart @@ -61,8 +61,8 @@ void main() { logger = _MockLogger(); final progress = _MockProgress(); - when(() => progress.complete(any())).thenAnswer((_) { - final message = _.positionalArguments.elementAt(0) as String?; + when(() => progress.complete(any())).thenAnswer((a) { + final message = a.positionalArguments.elementAt(0) as String?; if (message != null) progressLogs.add(message); }); when(() => logger.progress(any())).thenReturn(progress); @@ -148,9 +148,9 @@ void main() { vars: any(named: 'vars'), logger: any(named: 'logger'), ), - ).thenAnswer((_) async { + ).thenAnswer((a) async { final target = - _.positionalArguments.first as DirectoryGeneratorTarget; + a.positionalArguments.first as DirectoryGeneratorTarget; File(path.join(target.dir.path, 'my_app', 'pubspec.yaml')) ..createSync(recursive: true) ..writeAsStringSync(pubspec); diff --git a/test/src/commands/create/commands/flutter_app_test.dart b/test/src/commands/create/commands/flutter_app_test.dart index 21481f95..8f8d7fff 100644 --- a/test/src/commands/create/commands/flutter_app_test.dart +++ b/test/src/commands/create/commands/flutter_app_test.dart @@ -66,8 +66,8 @@ void main() { logger = _MockLogger(); final progress = _MockProgress(); - when(() => progress.complete(any())).thenAnswer((_) { - final message = _.positionalArguments.elementAt(0) as String?; + when(() => progress.complete(any())).thenAnswer((a) { + final message = a.positionalArguments.elementAt(0) as String?; if (message != null) progressLogs.add(message); }); when(() => logger.progress(any())).thenReturn(progress); @@ -141,9 +141,9 @@ void main() { vars: any(named: 'vars'), logger: any(named: 'logger'), ), - ).thenAnswer((_) async { + ).thenAnswer((a) async { final target = - _.positionalArguments.first as DirectoryGeneratorTarget; + a.positionalArguments.first as DirectoryGeneratorTarget; File(path.join(target.dir.path, 'my_app', 'pubspec.yaml')) ..createSync(recursive: true) ..writeAsStringSync(pubspec); diff --git a/test/src/commands/create/commands/flutter_package_test.dart b/test/src/commands/create/commands/flutter_package_test.dart index 8e4a666c..85695daf 100644 --- a/test/src/commands/create/commands/flutter_package_test.dart +++ b/test/src/commands/create/commands/flutter_package_test.dart @@ -141,9 +141,9 @@ void main() { vars: any(named: 'vars'), logger: any(named: 'logger'), ), - ).thenAnswer((_) async { + ).thenAnswer((a) async { final target = - _.positionalArguments.first as DirectoryGeneratorTarget; + a.positionalArguments.first as DirectoryGeneratorTarget; File(path.join(target.dir.path, 'my_flutter_package', 'pubspec.yaml')) ..createSync(recursive: true) ..writeAsStringSync(pubspec); diff --git a/test/src/commands/create/commands/flutter_plugin_test.dart b/test/src/commands/create/commands/flutter_plugin_test.dart index 29c0439b..1c97c799 100644 --- a/test/src/commands/create/commands/flutter_plugin_test.dart +++ b/test/src/commands/create/commands/flutter_plugin_test.dart @@ -154,9 +154,9 @@ void main() { vars: any(named: 'vars'), logger: any(named: 'logger'), ), - ).thenAnswer((_) async { + ).thenAnswer((a) async { final target = - _.positionalArguments.first as DirectoryGeneratorTarget; + a.positionalArguments.first as DirectoryGeneratorTarget; File(path.join(target.dir.path, 'my_plugin', 'pubspec.yaml')) ..createSync(recursive: true) ..writeAsStringSync(pubspec); diff --git a/test/src/commands/create/create_subcommand_test.dart b/test/src/commands/create/create_subcommand_test.dart index ff5eedcb..c85836d4 100644 --- a/test/src/commands/create/create_subcommand_test.dart +++ b/test/src/commands/create/create_subcommand_test.dart @@ -113,8 +113,8 @@ void main() { logger = _MockLogger(); progress = _MockProgress(); - when(() => progress.complete(any())).thenAnswer((_) { - final message = _.positionalArguments.elementAt(0) as String?; + when(() => progress.complete(any())).thenAnswer((a) { + final message = a.positionalArguments.elementAt(0) as String?; if (message != null) progressLogs.add(message); }); when(() => logger.progress(any())).thenReturn(progress); From 589bcb015eb29e5b70c8dd14e35eb3e0fe0fa0f9 Mon Sep 17 00:00:00 2001 From: Tom Arra Date: Fri, 20 Dec 2024 09:13:16 -0600 Subject: [PATCH 3/5] fixing html warning --- lib/src/cli/flutter_cli.dart | 2 +- lib/src/commands/create/commands/create_subcommand.dart | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/src/cli/flutter_cli.dart b/lib/src/cli/flutter_cli.dart index 9b136ae2..f9f1a402 100644 --- a/lib/src/cli/flutter_cli.dart +++ b/lib/src/cli/flutter_cli.dart @@ -112,7 +112,7 @@ typedef FlutterTestRunner = Stream Function({ bool runInShell, }); -/// A method which returns a [Future] given a [MasonBundle]. +/// A method which returns a [`Future`] given a [MasonBundle]. typedef GeneratorBuilder = Future Function(MasonBundle); /// Flutter CLI diff --git a/lib/src/commands/create/commands/create_subcommand.dart b/lib/src/commands/create/commands/create_subcommand.dart index 42137308..4f7e6182 100644 --- a/lib/src/commands/create/commands/create_subcommand.dart +++ b/lib/src/commands/create/commands/create_subcommand.dart @@ -18,10 +18,10 @@ final RegExp _orgNameRegExp = RegExp(r'^[a-zA-Z][\w-]*(\.[a-zA-Z][\w-]*)+$'); const _defaultOrgName = 'com.example.verygoodcore'; const _defaultDescription = 'A Very Good Project created by Very Good CLI.'; -/// A method which returns a [Future] given a [MasonBundle]. +/// A method which returns a [`Future`] given a [MasonBundle]. typedef MasonGeneratorFromBundle = Future Function(MasonBundle); -/// A method which returns a [Future] given a [Brick]. +/// A method which returns a [`Future`] given a [Brick]. typedef MasonGeneratorFromBrick = Future Function(Brick); /// {@template create_subcommand} From 11c37f4e0099d61e11a5a977f8d2f10970bbd3ee Mon Sep 17 00:00:00 2001 From: Tom Arra Date: Fri, 20 Dec 2024 09:18:13 -0600 Subject: [PATCH 4/5] Revert "analysis updates and fixes" This reverts commit 2acece7e69e6bcb0a252044046762a641889f38e. --- analysis_options.yaml | 2 +- lib/src/cli/dart_cli.dart | 2 +- lib/src/cli/flutter_cli.dart | 2 +- lib/src/cli/git_cli.dart | 2 +- lib/src/command_runner.dart | 2 +- lib/src/commands/create/commands/create_subcommand.dart | 2 +- .../packages/commands/check/commands/licenses.dart | 6 +++--- lib/src/commands/packages/commands/get.dart | 2 +- lib/src/commands/test/test.dart | 2 +- lib/src/commands/update.dart | 4 ++-- lib/src/pubspec_lock/pubspec_lock.dart | 6 +++--- lib/very_good_cli.dart | 2 +- pubspec.yaml | 2 +- test/ensure_build_test.dart | 2 +- test/helpers/command_helper.dart | 4 ++-- test/src/command_runner_test.dart | 4 ++-- test/src/commands/create/commands/dart_cli_test.dart | 4 ++-- test/src/commands/create/commands/dart_package_test.dart | 4 ++-- test/src/commands/create/commands/docs_site_test.dart | 4 ++-- test/src/commands/create/commands/flame_game_test.dart | 8 ++++---- test/src/commands/create/commands/flutter_app_test.dart | 8 ++++---- .../commands/create/commands/flutter_package_test.dart | 4 ++-- .../src/commands/create/commands/flutter_plugin_test.dart | 4 ++-- test/src/commands/create/create_subcommand_test.dart | 4 ++-- 24 files changed, 43 insertions(+), 43 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index 3477486a..646bccec 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,4 +1,4 @@ -include: package:very_good_analysis/analysis_options.7.0.0.yaml +include: package:very_good_analysis/analysis_options.5.1.0.yaml analyzer: exclude: - "**/version.dart" diff --git a/lib/src/cli/dart_cli.dart b/lib/src/cli/dart_cli.dart index ae9b290a..12940b9a 100644 --- a/lib/src/cli/dart_cli.dart +++ b/lib/src/cli/dart_cli.dart @@ -9,7 +9,7 @@ class Dart { try { await _Cmd.run('dart', ['--version'], logger: logger); return true; - } on Exception catch (_) { + } catch (_) { return false; } } diff --git a/lib/src/cli/flutter_cli.dart b/lib/src/cli/flutter_cli.dart index f9f1a402..305d83aa 100644 --- a/lib/src/cli/flutter_cli.dart +++ b/lib/src/cli/flutter_cli.dart @@ -124,7 +124,7 @@ class Flutter { try { await _Cmd.run('flutter', ['--version'], logger: logger); return true; - } on Exception catch (_) { + } catch (_) { return false; } } diff --git a/lib/src/cli/git_cli.dart b/lib/src/cli/git_cli.dart index 2339a45a..e5df0631 100644 --- a/lib/src/cli/git_cli.dart +++ b/lib/src/cli/git_cli.dart @@ -31,7 +31,7 @@ class Git { ['ls-remote', '$remote', '--exit-code'], logger: logger, ); - } on Exception catch (_) { + } catch (_) { throw UnreachableGitDependency(remote: remote); } } diff --git a/lib/src/command_runner.dart b/lib/src/command_runner.dart index 91d20ab4..b9e6dbcf 100644 --- a/lib/src/command_runner.dart +++ b/lib/src/command_runner.dart @@ -146,7 +146,7 @@ ${lightYellow.wrap('Changelog:')} ${lightCyan.wrap('https://github.com/verygoodo Run ${lightCyan.wrap('very_good update')} to update''', ); } - } on Exception catch (_) {} + } catch (_) {} } void _showThankYou() { diff --git a/lib/src/commands/create/commands/create_subcommand.dart b/lib/src/commands/create/commands/create_subcommand.dart index 4f7e6182..714f5885 100644 --- a/lib/src/commands/create/commands/create_subcommand.dart +++ b/lib/src/commands/create/commands/create_subcommand.dart @@ -178,7 +178,7 @@ abstract class CreateSubCommand extends Command { '''Building generator from brick: ${brick.name} ${brick.location.version}''', ); return await _generatorFromBrick(brick); - } on Exception catch (error) { + } catch (error) { logger.detail('Building generator from brick failed: $error'); } logger.detail( diff --git a/lib/src/commands/packages/commands/check/commands/licenses.dart b/lib/src/commands/packages/commands/check/commands/licenses.dart index ff6b7ad3..d66d6eba 100644 --- a/lib/src/commands/packages/commands/check/commands/licenses.dart +++ b/lib/src/commands/packages/commands/check/commands/licenses.dart @@ -269,7 +269,7 @@ class PackagesCheckLicensesCommand extends Command { try { detectorResult = await detectLicense(licenseFileContent, _defaultDetectionThreshold); - } on Exception catch (e) { + } catch (e) { final errorMessage = '''[$dependencyName] Failed to detect license from $packagePath: $e'''; if (!ignoreFailures) { @@ -330,7 +330,7 @@ PubspecLock? _tryParsePubspecLock(File pubspecLockFile) { final content = pubspecLockFile.readAsStringSync(); try { return PubspecLock.fromString(content); - } on Exception catch (_) {} + } catch (_) {} } return null; @@ -348,7 +348,7 @@ Future _tryFindPackageConfig( final findPackageConfig = findPackageConfigOverride ?? package_config.findPackageConfig; return await findPackageConfig(directory); - } on Exception { + } catch (error) { return null; } } diff --git a/lib/src/commands/packages/commands/get.dart b/lib/src/commands/packages/commands/get.dart index e0855ac3..7c4f0053 100644 --- a/lib/src/commands/packages/commands/get.dart +++ b/lib/src/commands/packages/commands/get.dart @@ -61,7 +61,7 @@ class PackagesGetCommand extends Command { } on PubspecNotFound catch (_) { _logger.err('Could not find a pubspec.yaml in $targetPath'); return ExitCode.noInput.code; - } on Exception catch (error) { + } catch (error) { _logger.err('$error'); return ExitCode.unavailable.code; } diff --git a/lib/src/commands/test/test.dart b/lib/src/commands/test/test.dart index 342cf2c9..634d7568 100644 --- a/lib/src/commands/test/test.dart +++ b/lib/src/commands/test/test.dart @@ -229,7 +229,7 @@ This command should be run from the root of your Flutter project.''', '''Expected coverage >= ${minCoverage.toStringAsFixed(decimalPlaces)}% but actual is ${e.coverage.toStringAsFixed(decimalPlaces)}%.''', ); return ExitCode.unavailable.code; - } on Exception catch (error) { + } catch (error) { _logger.err('$error'); return ExitCode.unavailable.code; } diff --git a/lib/src/commands/update.dart b/lib/src/commands/update.dart index 7926ad52..dbce0207 100644 --- a/lib/src/commands/update.dart +++ b/lib/src/commands/update.dart @@ -35,7 +35,7 @@ class UpdateCommand extends Command { late final String latestVersion; try { latestVersion = await _pubUpdater.getLatestVersion(packageName); - } on Exception catch (error) { + } catch (error) { updateCheckProgress.fail(); _logger.err('$error'); return ExitCode.software.code; @@ -57,7 +57,7 @@ class UpdateCommand extends Command { packageName: packageName, versionConstraint: latestVersion, ); - } on Exception catch (error) { + } catch (error) { updateProgress.fail(); _logger.err('$error'); return ExitCode.software.code; diff --git a/lib/src/pubspec_lock/pubspec_lock.dart b/lib/src/pubspec_lock/pubspec_lock.dart index d2c2ce10..2120a067 100644 --- a/lib/src/pubspec_lock/pubspec_lock.dart +++ b/lib/src/pubspec_lock/pubspec_lock.dart @@ -4,7 +4,7 @@ /// source of the dependencies to analyze. Hence, it is not a complete parser, /// it only parses the information that is needed for the /// `packages check license` command. -library; +library pubspec_lock; import 'dart:collection'; @@ -38,7 +38,7 @@ class PubspecLock { late final YamlMap yaml; try { yaml = loadYaml(content) as YamlMap; - } on Exception catch (_) { + } catch (_) { throw const PubspecLockParseException(); } @@ -56,7 +56,7 @@ class PubspecLock { data: entry.value as YamlMap, ); parsedPackages.add(package); - } on Exception catch (_) { + } catch (_) { // Ignore those packages that for some reason cannot be parsed. } } diff --git a/lib/very_good_cli.dart b/lib/very_good_cli.dart index 42ed941c..bc8f2784 100644 --- a/lib/very_good_cli.dart +++ b/lib/very_good_cli.dart @@ -7,4 +7,4 @@ /// # see usage /// very_good --help /// ``` -library; +library very_good_cli; diff --git a/pubspec.yaml b/pubspec.yaml index fd78f02c..ae853503 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -36,7 +36,7 @@ dev_dependencies: build_version: ^2.1.1 mocktail: ^1.0.4 test: ^1.25.8 - very_good_analysis: ^7.0.0 + very_good_analysis: ">=6.0.0 <8.0.0" executables: very_good: diff --git a/test/ensure_build_test.dart b/test/ensure_build_test.dart index 8627c296..dca607a8 100644 --- a/test/ensure_build_test.dart +++ b/test/ensure_build_test.dart @@ -1,5 +1,5 @@ @Tags(['pull-request-only']) -library; +library ensure_build_test; import 'package:build_verify/build_verify.dart'; import 'package:test/test.dart'; diff --git a/test/helpers/command_helper.dart b/test/helpers/command_helper.dart index e3cee8c1..3920f25f 100644 --- a/test/helpers/command_helper.dart +++ b/test/helpers/command_helper.dart @@ -45,8 +45,8 @@ void Function() withRunner( environment: {'CI': 'true'}, ); - when(() => progress.complete(any())).thenAnswer((a) { - final message = a.positionalArguments.elementAt(0) as String?; + when(() => progress.complete(any())).thenAnswer((_) { + final message = _.positionalArguments.elementAt(0) as String?; if (message != null) progressLogs.add(message); }); when(() => logger.progress(any())).thenReturn(progress); diff --git a/test/src/command_runner_test.dart b/test/src/command_runner_test.dart index d96af834..5c207b38 100644 --- a/test/src/command_runner_test.dart +++ b/test/src/command_runner_test.dart @@ -116,8 +116,8 @@ void main() { ).thenAnswer((_) => Future.value(true)); final progress = _MockProgress(); final progressLogs = []; - when(() => progress.complete(any())).thenAnswer((a) { - final message = a.positionalArguments.elementAt(0) as String?; + when(() => progress.complete(any())).thenAnswer((_) { + final message = _.positionalArguments.elementAt(0) as String?; if (message != null) progressLogs.add(message); }); when(() => logger.progress(any())).thenReturn(progress); diff --git a/test/src/commands/create/commands/dart_cli_test.dart b/test/src/commands/create/commands/dart_cli_test.dart index 52684a80..e552fa79 100644 --- a/test/src/commands/create/commands/dart_cli_test.dart +++ b/test/src/commands/create/commands/dart_cli_test.dart @@ -143,9 +143,9 @@ void main() { vars: any(named: 'vars'), logger: any(named: 'logger'), ), - ).thenAnswer((a) async { + ).thenAnswer((_) async { final target = - a.positionalArguments.first as DirectoryGeneratorTarget; + _.positionalArguments.first as DirectoryGeneratorTarget; File(path.join(target.dir.path, 'my_cli', 'pubspec.yaml')) ..createSync(recursive: true) ..writeAsStringSync(pubspec); diff --git a/test/src/commands/create/commands/dart_package_test.dart b/test/src/commands/create/commands/dart_package_test.dart index f31ebc2c..8bb6ec39 100644 --- a/test/src/commands/create/commands/dart_package_test.dart +++ b/test/src/commands/create/commands/dart_package_test.dart @@ -143,9 +143,9 @@ void main() { vars: any(named: 'vars'), logger: any(named: 'logger'), ), - ).thenAnswer((a) async { + ).thenAnswer((_) async { final target = - a.positionalArguments.first as DirectoryGeneratorTarget; + _.positionalArguments.first as DirectoryGeneratorTarget; File(path.join(target.dir.path, 'my_package', 'pubspec.yaml')) ..createSync(recursive: true) ..writeAsStringSync(pubspec); diff --git a/test/src/commands/create/commands/docs_site_test.dart b/test/src/commands/create/commands/docs_site_test.dart index d15b8b15..b3ba0bd8 100644 --- a/test/src/commands/create/commands/docs_site_test.dart +++ b/test/src/commands/create/commands/docs_site_test.dart @@ -142,9 +142,9 @@ void main() { vars: any(named: 'vars'), logger: any(named: 'logger'), ), - ).thenAnswer((a) async { + ).thenAnswer((_) async { final target = - a.positionalArguments.first as DirectoryGeneratorTarget; + _.positionalArguments.first as DirectoryGeneratorTarget; File(path.join(target.dir.path, 'my_docs_site', 'pubspec.yaml')) ..createSync(recursive: true) ..writeAsStringSync(pubspec); diff --git a/test/src/commands/create/commands/flame_game_test.dart b/test/src/commands/create/commands/flame_game_test.dart index 8559e833..8bebfab2 100644 --- a/test/src/commands/create/commands/flame_game_test.dart +++ b/test/src/commands/create/commands/flame_game_test.dart @@ -61,8 +61,8 @@ void main() { logger = _MockLogger(); final progress = _MockProgress(); - when(() => progress.complete(any())).thenAnswer((a) { - final message = a.positionalArguments.elementAt(0) as String?; + when(() => progress.complete(any())).thenAnswer((_) { + final message = _.positionalArguments.elementAt(0) as String?; if (message != null) progressLogs.add(message); }); when(() => logger.progress(any())).thenReturn(progress); @@ -148,9 +148,9 @@ void main() { vars: any(named: 'vars'), logger: any(named: 'logger'), ), - ).thenAnswer((a) async { + ).thenAnswer((_) async { final target = - a.positionalArguments.first as DirectoryGeneratorTarget; + _.positionalArguments.first as DirectoryGeneratorTarget; File(path.join(target.dir.path, 'my_app', 'pubspec.yaml')) ..createSync(recursive: true) ..writeAsStringSync(pubspec); diff --git a/test/src/commands/create/commands/flutter_app_test.dart b/test/src/commands/create/commands/flutter_app_test.dart index 8f8d7fff..21481f95 100644 --- a/test/src/commands/create/commands/flutter_app_test.dart +++ b/test/src/commands/create/commands/flutter_app_test.dart @@ -66,8 +66,8 @@ void main() { logger = _MockLogger(); final progress = _MockProgress(); - when(() => progress.complete(any())).thenAnswer((a) { - final message = a.positionalArguments.elementAt(0) as String?; + when(() => progress.complete(any())).thenAnswer((_) { + final message = _.positionalArguments.elementAt(0) as String?; if (message != null) progressLogs.add(message); }); when(() => logger.progress(any())).thenReturn(progress); @@ -141,9 +141,9 @@ void main() { vars: any(named: 'vars'), logger: any(named: 'logger'), ), - ).thenAnswer((a) async { + ).thenAnswer((_) async { final target = - a.positionalArguments.first as DirectoryGeneratorTarget; + _.positionalArguments.first as DirectoryGeneratorTarget; File(path.join(target.dir.path, 'my_app', 'pubspec.yaml')) ..createSync(recursive: true) ..writeAsStringSync(pubspec); diff --git a/test/src/commands/create/commands/flutter_package_test.dart b/test/src/commands/create/commands/flutter_package_test.dart index 85695daf..8e4a666c 100644 --- a/test/src/commands/create/commands/flutter_package_test.dart +++ b/test/src/commands/create/commands/flutter_package_test.dart @@ -141,9 +141,9 @@ void main() { vars: any(named: 'vars'), logger: any(named: 'logger'), ), - ).thenAnswer((a) async { + ).thenAnswer((_) async { final target = - a.positionalArguments.first as DirectoryGeneratorTarget; + _.positionalArguments.first as DirectoryGeneratorTarget; File(path.join(target.dir.path, 'my_flutter_package', 'pubspec.yaml')) ..createSync(recursive: true) ..writeAsStringSync(pubspec); diff --git a/test/src/commands/create/commands/flutter_plugin_test.dart b/test/src/commands/create/commands/flutter_plugin_test.dart index 1c97c799..29c0439b 100644 --- a/test/src/commands/create/commands/flutter_plugin_test.dart +++ b/test/src/commands/create/commands/flutter_plugin_test.dart @@ -154,9 +154,9 @@ void main() { vars: any(named: 'vars'), logger: any(named: 'logger'), ), - ).thenAnswer((a) async { + ).thenAnswer((_) async { final target = - a.positionalArguments.first as DirectoryGeneratorTarget; + _.positionalArguments.first as DirectoryGeneratorTarget; File(path.join(target.dir.path, 'my_plugin', 'pubspec.yaml')) ..createSync(recursive: true) ..writeAsStringSync(pubspec); diff --git a/test/src/commands/create/create_subcommand_test.dart b/test/src/commands/create/create_subcommand_test.dart index c85836d4..ff5eedcb 100644 --- a/test/src/commands/create/create_subcommand_test.dart +++ b/test/src/commands/create/create_subcommand_test.dart @@ -113,8 +113,8 @@ void main() { logger = _MockLogger(); progress = _MockProgress(); - when(() => progress.complete(any())).thenAnswer((a) { - final message = a.positionalArguments.elementAt(0) as String?; + when(() => progress.complete(any())).thenAnswer((_) { + final message = _.positionalArguments.elementAt(0) as String?; if (message != null) progressLogs.add(message); }); when(() => logger.progress(any())).thenReturn(progress); From c47437f25dcd4b18f1230c92c1686b3a42f27d3d Mon Sep 17 00:00:00 2001 From: Tom Arra Date: Fri, 20 Dec 2024 09:18:37 -0600 Subject: [PATCH 5/5] just the analysis files --- analysis_options.yaml | 2 +- pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index 646bccec..3477486a 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,4 +1,4 @@ -include: package:very_good_analysis/analysis_options.5.1.0.yaml +include: package:very_good_analysis/analysis_options.7.0.0.yaml analyzer: exclude: - "**/version.dart" diff --git a/pubspec.yaml b/pubspec.yaml index ae853503..fd78f02c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -36,7 +36,7 @@ dev_dependencies: build_version: ^2.1.1 mocktail: ^1.0.4 test: ^1.25.8 - very_good_analysis: ">=6.0.0 <8.0.0" + very_good_analysis: ^7.0.0 executables: very_good: