dependency_validator 3.1.0
dependency_validator: ^3.1.0 copied to clipboard

Checks for missing, under-promoted, over-promoted, and unused dependencies.

Dependency Validator #

A tool to help you find missing, under-promoted, over-promoted, and unused dependencies.

Installation #

Add the following to your pubspec.yaml:

dev_dependencies:
  dependency_validator: ^3.0.0

Usage #

pub run dependency_validator

This will report any missing, under-promoted, over-promoted, and unused dependencies. Any package that either provides an executable or a builder that will be auto-applied via the dart build system will be considered used even if it isn't imported.

  • Missing: When a dependency is used in the package but not declared in the pubspec.yaml
  • Under-promoted: When a dependency is used within lib/ but only declared as a dev_dependency.
  • Over-promoted: When a dependency is only used outside lib/ but declared as a dependency.
  • Unused: When a dependency is not used in the package but declared in the pubspec.yaml.

Configuration #

There may be packages that are intentionally depended on but not used, or there may be directories that need to be ignored. You can statically configure these things in a dart_dependency_validator.yaml file in the root of your package:

# dart_dependency_validator.yaml

# Exclude one or more paths from being scanned. Supports glob syntax.
exclude:
  - "app/**"
# Ignore one or more packages.
ignore:
  - analyzer

Note: Previously this configuration lived in the pubspec.yaml, but that option was deprecated because pub publish warns about unrecognized keys.

30
likes
120
pub points
87%
popularity

Publisher

workiva.com

Checks for missing, under-promoted, over-promoted, and unused dependencies.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache 2.0 (LICENSE)

Dependencies

args, build_config, checked_yaml, glob, io, json_annotation, logging, package_config, path, pub_semver, pubspec_parse, yaml

More

Packages that depend on dependency_validator