max_directory_depth
Tree depth from repo root may not exceed max_depth. A shallow depth stops deeply-nested imports and keeps CI path globs sane.
Options
Section titled "Options"| Option | Type | Required | Default | Description |
|---|---|---|---|---|
max_depth | integer (>= 1) | yes | Maximum allowed path depth (number of /-separated components). |
Plus the common paths, level, id, when, and expect_matches fields. This table is generated from the JSON Schema; option types and defaults are authoritative.
Example
Section titled "Example"A source file nested too many directories deep
Section titled "A source file nested too many directories deep"The rule fires on this repository:
- src/
- src/deep/
- src/deep/nested/
- src/deep/nested/way_down/
- src/deep/nested/way_down/lost.rs
⚠ warning shallow
src/deep/nested/way_down/lost.rs is at depth 5; max is 3
- src/lib.rs✓
- top.txt✓
With this .alint.yml:
version: 1rules: - id: shallow kind: max_directory_depth paths: "**" max_depth: 3 level: warningalint check reports:
--- src/deep/nested/way_down/lost.rs ------------------------------------------- ! warning shallow src/deep/nested/way_down/lost.rs is at depth 5; max is 3
Summary (1 violation): ! 1 warning 0 passing * 1 failingEvery file stays within the directory-depth cap
Section titled "Every file stays within the directory-depth cap"This repository is compliant:
- README.md✓
- src/
- src/lib.rs✓
- src/mod/
- src/mod/inner.rs✓
With this .alint.yml:
version: 1rules: - id: shallow kind: max_directory_depth paths: "**" max_depth: 3 level: warningalint check reports:
v All 1 rule(s) passed.