Rulebearing Playground Coverage Schemas GitHub

ADR-0066: Project scope and the project layer

Context

dependency-cruiser computes instability for modules and for folders. A folder record (folders[]) carries moduleCount, the folders it depends on and that depend on it, afferent and efferent couplings, and instability. A scope: folder rule, such as to.moreUnstable or to.circular, then compares folders.

The design promises the same for .NET projects, and the PRD asks for moreUnstable and metrics over projects. Nothing computed them. The .NET extractor already records each module's project (Module::project, the .csproj that owns the file), and the Python extractor records the package, so the facts were in the graph and only the aggregation was missing. A project's folder is not its project: a solution's projects often share folders, and a project's files can sit outside its folder.

Decision

The project layer mirrors the folder layer.

scope: project compares projects as scope: folder compares folders:

It is a native-configuration addition: in a .dependency-cruiser.* file it is exit 3, naming the fix (move the rule, or use scope: folder). Cross-language keys and graph are refused on it, as on a folder rule.

The metrics reporter lists projects beside folders and modules, with type project, when projects[] is present. reporterOptions.metrics.hideProjects hides them, as hideFolders hides folders.

snapshot records instability per project beside instability per folder, when the run has projects.

Consequences

Alternatives considered

Option Why not
Record that a project's instability is its folder's Wrong when projects share a folder or a project spans folders, which solutions often do. The PRD asks for projects.
Count only project-to-project edges, leaving packages out Martin's efferent coupling counts every dependency the component owns. The folder layer counts packages, and the two layers should read the same.
A separate record type for projects Every reporter, the anonymiser and the metrics table already read folder records. The same shape keeps them working unchanged.