This package provides presets for flutter analyze.

  • Enables the very_good_analysis recommended rules.
  • Enables the DCM recommended rules, enables many more, and explicitly the rest.
  • Adjust formatting settings.

Usage

  1. Update pubspec.yaml:
dev_dependencies:
  vihanti_analysis_presets: ^1.0.0
  1. Update analysis_options.yaml:
include: package:vihanti_analysis_presets/recommended.yaml

New DCM Rules

Each release of vihanti_analysis_presets aims to explicitly enable or disable all DCM rules for the version of DCM that's defined in dart_code_metrics:version in lib/recommended.yaml. However, new DCM versions often contain new rules. To identify new rules, run this command:

dart run vihanti_analysis_presets:new_dcm_rules

DCM Version

For CI/CD purposes, it can be helpful to install the version of DCM that matches the rules defined in this package, so that upgrading this package automatically installs the recommended version of DCM. This is unrelated to the dcm_global.yaml version which is a version constraint rather than a recommended version. To get the recommended version, run this command:

dart run vihanti_analysis_presets:dcm_version

Libraries