diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9e064a3..cb890af 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -8,16 +8,16 @@ on: jobs: build: - uses: Workiva/gha-dart-oss/.github/workflows/build.yaml@v0.1.14 + uses: Workiva/gha-dart-oss/.github/workflows/build.yaml@v0.1.15 with: sdk: 3.7.2 # mirrors .tool-versions checks: - uses: Workiva/gha-dart-oss/.github/workflows/checks.yaml@v0.1.14 + uses: Workiva/gha-dart-oss/.github/workflows/checks.yaml@v0.1.15 with: sdk: 3.7.2 # mirrors .tool-versions unit-tests: - uses: Workiva/gha-dart-oss/.github/workflows/test-unit.yaml@v0.1.14 + uses: Workiva/gha-dart-oss/.github/workflows/test-unit.yaml@v0.1.15 with: sdk: 3.7.2 # mirrors .tool-versions diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index b9f8c3e..ff1fb2c 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -12,6 +12,6 @@ permissions: jobs: publish: - uses: Workiva/gha-dart-oss/.github/workflows/publish.yaml@v0.1.14 + uses: Workiva/gha-dart-oss/.github/workflows/publish.yaml@v0.1.15 with: sdk: stable diff --git a/CHANGELOG.md b/CHANGELOG.md index 3041743..7d3057c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ newest one the analyzer knows about, which may be unreleased and reject valid code +- Allow up to analyzer 14 + +- Fix warning when `analyzer` is depended on but not used so that it is still + emitted when `analyzer` is in the `ignore` list. + # 5.0.6 - Allow up to analyzer 13 diff --git a/lib/src/dependency_validator.dart b/lib/src/dependency_validator.dart index 631bc7e..835a360 100644 --- a/lib/src/dependency_validator.dart +++ b/lib/src/dependency_validator.dart @@ -315,7 +315,7 @@ Future checkPackage({required String root}) async { } // Packages that are not used anywhere but are dependencies. - final unusedDependencies = + final rawUnusedDependencies = // Start with all explicitly declared dependencies deps .union(devDeps) @@ -323,8 +323,9 @@ Future checkPackage({required String root}) async { .difference(packagesUsedInPublicFiles) .difference(packagesUsedOutsidePublicDirs) // Remove this package, since we know they're using our executable - ..remove(dependencyValidatorPackageName) - ..removeAll(ignoredPackages); + ..remove(dependencyValidatorPackageName); + final unusedDependencies = rawUnusedDependencies.toSet() + ..removeAll(ignoredPackages); final packageConfig = await findPackageConfig(Directory.current); if (packageConfig == null) { @@ -405,7 +406,7 @@ Future checkPackage({required String root}) async { ); unusedDependencies.removeAll(packagesWithExecutables); - if (unusedDependencies.contains('analyzer')) { + if (rawUnusedDependencies.contains('analyzer')) { logger.warning( yellow.wrap( 'You do not need to depend on `analyzer` to run the Dart analyzer.\n' diff --git a/test/executable_test.dart b/test/executable_test.dart index a9be86c..a452d16 100644 --- a/test/executable_test.dart +++ b/test/executable_test.dart @@ -335,9 +335,9 @@ void main() { test('passes when dependencies not used provide executables', () async { result = await checkProject( devDependencies: { - "build_runner": hostedCompatibleWith('2.3.3'), + "build_runner": hostedAny, 'coverage': hostedAny, - 'dart_style': hostedCompatibleWith('2.3.2'), + 'dart_style': hostedAny, }, project: [ d.dir('lib', [d.file('main.dart', 'book fake = true;')]), @@ -353,9 +353,9 @@ void main() { () async { result = await checkProject( dependencies: { - "build_runner": hostedCompatibleWith('2.3.3'), + "build_runner": hostedAny, "coverage": hostedAny, - "dart_style": hostedCompatibleWith('2.3.2'), + "dart_style": hostedAny, }, project: [ d.dir('lib', [d.file('main.dart', 'bool fake = true;')]), @@ -377,9 +377,9 @@ void main() { () async { result = await checkProject( devDependencies: { - 'build_test': hostedCompatibleWith('2.0.1'), - 'build_vm_compilers': hostedCompatibleWith('1.0.3'), - 'build_web_compilers': hostedCompatibleWith('3.2.7'), + 'build_test': hostedAny, + 'json_serializable': hostedAny, + 'build_web_compilers': hostedAny, }, project: [ d.dir('lib', [d.file('main.dart', 'book fake = true;')]),