dcq_standalone 0.5.0 copy "dcq_standalone: ^0.5.0" to clipboard
dcq_standalone: ^0.5.0 copied to clipboard

Standalone CLI for running DCQ rules against any Dart project.

dcq_standalone #

Standalone CLI for running DCQ lint rules against any Dart or Flutter project, regardless of the target project's analyzer version.

Installation #

dart pub global activate dcq_standalone

This adds the dcq command to your PATH.

Usage #

Lint rules #

# Analyze current directory
dcq

# Analyze a specific project
dcq /path/to/project

# Only run specific rules
dcq --rules=avoid-dynamic,no-empty-block

# JSON output (for CI integration)
dcq --json

Dead code analysis #

# Find unused declarations in a project
dcq dead-code /path/to/project

# Analyze a monorepo (multiple packages)
dcq dead-code .
dcq dead-code path/to/packages/or/repo/root

# Analyze a subset of packages in a mono-repo
dcq dead-code packages/some packages/subset packages/of_packages

# Analyze a mono-repo and its known consumers
dcq dead-code repo1/packages repo2/packages

# Include private declarations in output
dcq dead-code --include-private .

# Show nearly-unused symbols (low external references)
dcq dead-code --nearly-unused .

# Show dependency usage stats
dcq dead-code --low-usage-deps .

# JSON output
dcq dead-code --json .

# Benchmark analysis time
dcq dead-code --benchmark .

How it works #

The tool creates its own AnalysisContextCollection using the analyzer package bundled with DCQ — not the target project's. This means it works on projects with any Dart SDK version, since it brings its own analyzer.

Because dcq_standalone manages its own dependencies, it does not need to be added as a dependency in your project's pubspec.yaml. This is what allows it to work on projects with outdated or conflicting analyzer versions.

Rules read configuration from the target project's analysis_options.yaml (dart_code_quality: section), so per-project config is respected.

Library API #

The analysis engine is also available as a library:

import 'package:dcq_standalone/dcq_standalone.dart';

final rules = collectAllRules(projectRoot: '/path/to/project');
final issues = await analyzePackage('/path/to/project', rules);