dependency_validator 1.5.0

  • Readme
  • Changelog
  • Installing
  • 86

Dependency Validator #

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

Getting Started #

Install dependency_validator #

Add the following to your pubspec.yaml:

  dependency_validator: ^1.0.0

Usage #

This package comes with a single executable: dependency_validator. To run this executable: pub run dependency_validator. This usage will run the tool and report any missing, under-promoted, over-promoted, and unused dependencies.

  • Missing: When a dependency is used in the package but not declared in the pubspec.yaml
    • Optionaly do not fail by using the --no-fatal-missing flag.
  • Under-promoted: When a dependency is used within lib/ but only declared as a dev_dependency.
    • Optionaly do not fail by using the --no-fatal-under-promoted flag.
  • Over-promoted: When a dependency is only used outside lib/ but declared as a dependency.
    • Optionaly do not fail by using the --no-fatal-over-promoted flag.
  • Unused: When a dependency is not used in the package but declared in the pubspec.yaml.
    • Optionaly do not fail by using the --no-fatal-unused flag.
    • Some packages are not imported by any dart files but are used for their executables. If that is the case they can be white-listed by using the --ignore option.
    dependency_validator --ignore coverage,dartdoc
  • Common binary packages: By default, common packages used solely for their binaries, such as build_runner and dart_style, are automatically ignored. For the current set of whitelisted binary packages, refer to the help: dependency_validator -h.
    • Optionally do not ignore common binary packages using the --no-ignore-common-binaries flag.

1.5.0 #

  • Scan .less files for Dart package imports.

1.4.2 #

  • Detect package usage in analysis_options.yaml files.

1.4.1 #

  • Add dart_dev to common binaries list so that it is automatically ignored.

1.4.0 #

  • Improvement: Add coverage and build_vm_compilers to the list of commonly used binary packages that are ignored by default. #50

  • Raised minimum Dart SDK version to 2.2.0 (no longer supports Dart 1). #50

1.3.0 #

  • Improvement: Ignore commonly used binary packages by default. This can be disabled via --no-ignore-common-binaries. Run pub run dependency_validator -h to see which packages will be ignored by this flag. #47

1.2.4 #

  • Bug Fix: Ignoring a package via --ignore or -i will now also work as expected for the "over-promoted" failure. #44

1.2.2 #

  • Bug Fix: Ignoring a package via --ignore or -i will now also work as expected for the "pinned dependency" failure. #39

1.2.1 #

  • Dart 2 compatible. #35

1.2.0 #

  • Feature: Pinning a dependency (i.e. preventing patch or minor versions from being consumed) now causes validator to fail. You can opt-out of this feature with --no-fatal-pins. #27

  • Feature: Added a --help flag that outputs usage information. #28

  • Improvement: Package imports in .scss files are now detected. #26

1.1.2 #

  • Initial Dart 2/DDC compatibility changes. #23

1.1.1 #

  • Bug Fix: Fix detection of packages whose names contain numbers. #17

1.1.0 #

  • Feature: Added flags to control the types of validations that this tool enforces. They all default to true, but can be opted out of like so:

    • --no-fatal-missing

    • --no-fatal-under-promoted

    • --no-fatal-over-promoted

    • --no-fatal-unused


  • Feature: Added --exclude-dir to allow excluding an entire directory from the dependency validator checks. #15

1.0.1 #

  • Bug Fix: Packages ignored via the --ignore option will no longer be reported at all (previously they were only being ignored in the "unused" list). #10 #12

1.0.0 #

  • Initial version!

Use this package as an executable

1. Install it

You can install the package from the command line:

$ pub global activate dependency_validator

2. Use it

The package has the following executables:

$ dependency_validator

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  dependency_validator: ^1.5.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:dependency_validator/dependency_validator.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Apr 7, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6

Health suggestions

Format bin/dependency_validator.dart.

Run dartfmt to format bin/dependency_validator.dart.

Format lib/dependency_validator.dart.

Run dartfmt to format lib/dependency_validator.dart.

Format lib/src/constants.dart.

Run dartfmt to format lib/src/constants.dart.

Format lib/src/utils.dart.

Run dartfmt to format lib/src/utils.dart.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and dependency_validator.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.3.0 <3.0.0
args >=0.13.7 <2.0.0 1.6.0
logging ^0.11.3+1 0.11.4
path ^1.4.2 1.6.4
pub_semver ^1.4.1 1.4.4
yaml ^2.1.13 2.2.0
Transitive dependencies
charcode 1.1.3
collection 1.14.12
meta 1.1.8
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
Dev dependencies
test ^1.9.4
test_descriptor ^1.2.0