Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ jobs:
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@rob/fix-skipped-tests-fallback

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO will update this once a real release of gha-dart-oss happens

with:
sdk: 3.7.2 # mirrors .tool-versions
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions lib/src/dependency_validator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -315,16 +315,17 @@ Future<bool> 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)
// Remove all deps that were used in Dart code somewhere in this package
.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) {
Expand Down Expand Up @@ -405,7 +406,7 @@ Future<bool> 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'
Expand Down
14 changes: 7 additions & 7 deletions test/executable_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;')]),
Expand All @@ -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;')]),
Expand All @@ -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;')]),
Expand Down
Loading