Documentation
Hyena is a Dart package and CLI for two related checks:
- Dead code: resolve declarations and references, build a reachability graph, and report declarations that have no path from a root.
- Complexity: parse functions, methods, constructors, and closures and calculate control-flow and size metrics.
It analyzes a Dart file or recursively scans a directory and can write console, JSON, Markdown, standalone HTML, or SARIF 2.1 output.
Choose a path
Section titled “Choose a path”| Goal | Start here |
|---|---|
| Run Hyena once | Getting started |
| Get quick answers about routes, generated code, and suppressions | FAQ |
| Pick an installation model | Installation |
| Upgrade an existing v2.x project | Migrate to v3.0 |
| Upgrade an existing v1.x project | Migrate to v2.0, then v3.0 |
| Look up a command or flag | CLI reference |
| Exclude files or change thresholds | Configuration |
| Analyze a Dart workspace or monorepo | Workspaces and monorepos |
| Preserve framework or generated entry roots | Framework entry roots |
| Understand a finding | Dead-code analysis or complexity analysis |
| Consume or publish a report | Report formats |
| Use results in automation | CI and automation |
| Connect an AI client | Safe AI and MCP |
| Call the analyzers from Dart | Library API and the generated API reference |
| Contribute to Hyena | Architecture and development |
Defaults at a glance
Section titled “Defaults at a glance”hyena: exclude: [] complexity: cyclomatic_threshold: 20 max_nesting: 5 max_parameters: 6 dead_code: ignore_main: true ignore_exports: false ignore_private: false entry_points: [] entry_point_annotations: []Hyena also excludes any path containing a directory segment named .dart_tool, build, or generated, even when it is not listed in exclude. Generated *.g.dart, *.freezed.dart, and *.mocks.dart files are handled automatically: dead-code analysis counts their references on a best-effort basis but never reports their declarations, and complexity analysis skips them. Do not list them in exclude. Generated files that fail resolution are silently ignored without a skippedFiles entry. Missing references can cause dead-code findings elsewhere; see Analysis flow.
Available in v3.0.0
Section titled “Available in v3.0.0”Hyena Dart v3.0.0:
- requires Dart SDK 3.11+ and analyzer 14; other dev tools in the project must also accept analyzer 14.x;
- skips non-generated files that fail to resolve, parse, or read with a
Warning: skipped <path>: <reason>line instead of aborting the run; - uses distinct exit codes:
0completed,1findings tripped--fail-on,2tool error,64usage error; - counts references from generated
.g.dart,.freezed.dart, and.mocks.dartfiles on a best-effort basis during dead-code analysis; and - removes the CLI runner and path helpers from the public library exports.
Existing v2.x projects should read Migrating from v2.x to v3.0 before upgrading.
Available in v2.0.0
Section titled “Available in v2.0.0”Hyena Dart v2.0.0 moves to project-local installation and execution, reports unused public and private declarations by default, and makes console, JSON, Markdown, and HTML paths consistently relative to the package or workspace root.
Existing v1.x projects should read Migrating from v1.x to v2.0 before upgrading. Existing baseline fingerprints remain valid; SARIF, baseline, and MCP paths were already relative in v1.x.
Fixed in v1.2.1
Section titled “Fixed in v1.2.1”Hyena Dart 1.2.1:
- joins dead-code reachability across workspace package boundaries, preserving the exact resolved declaration while ignoring references that occur only inside unreachable callers; and
- accepts native Windows separators in explicit and glob workspace entries.
Available in v1.2.0
Section titled “Available in v1.2.0”Hyena Dart 1.2.0 adds:
- CLI and MCP version output, with release checks that keep runtime output aligned with the package version;
- package-scoped Dart workspace analysis with workspace-relative findings; and
- configured declaration and annotation entry roots for framework- or generated-code reachability.
