Skip to main content

Command Line Interface

To use the package as a command-line tool, run:

$ flutter pub run dyzer <command> lib

Alternatively, the package can be installed globally:

$ flutter pub global activate dyzer
$ metrics <command> lib

It will produce a result in one of the supported formats:

  • Console
  • GitHub
  • Checkstyle
  • Codeclimate
  • HTML
  • JSON
-INFO

You need to configure rules entry in the analysis_options.yaml to have rules report included into the result.

Available commands

CommandExample of useShort description
analyzedart run dyzer analyze libReports code metrics, rules and anti-patterns violations.
check-unnecessary-nullabledart run dyzer check-unnecessary-nullable libChecks unnecessary nullable parameters.
check-unused-filesdart run dyzer check-unused-files libChecks unused *.dart files.
check-unused-l10ndart run dyzer check-unused-l10n libChecks unused localization in *.dart files.
check-unused-codedart run dyzer check-unused-code libChecks unused code in *.dart files.

For additional help on any of the commands:

$ flutter pub run dyzer --help <command>

Multi-package repositories usage

If you run a command from the root of a multi-package repository (a.k.a. monorepo), it'll pick up analysis_options.yaml files correctly.

Additionally, if you use Melos, you can add custom command to the melos.yaml.