dependency_validator 1.4.1

  • Readme
  • Changelog
  • Installing
  • 83

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:

dev_dependencies:
  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.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

      #14

  • 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:


dependencies:
  dependency_validator: ^1.4.1

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';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
70
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
83
Learn more about scoring.

We analyzed this package on Nov 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.1
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, other

Primary library: package:dependency_validator/dependency_validator.dart with components: io.

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/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.0 <3.0.0
args >=0.13.7 <2.0.0 1.5.2
logging ^0.11.3+1 0.11.3+2
path ^1.4.2 1.6.4
pub_semver ^1.4.1 1.4.2
yaml ^2.1.13 2.2.0
Transitive dependencies
charcode 1.1.2
collection 1.14.12
meta 1.1.8
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
Dev dependencies
test >=0.12.30 <2.0.0