Skip to content

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.

OptionTypeRequiredDefaultDescription
max_depthinteger (>= 1)yesMaximum allowed path depth (number of /-separated components).

Plus the common paths, level, id, and when fields. This table is generated from the JSON Schema; option types and defaults are authoritative.

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
src/lib.rs
top.txt

With this .alint.yml:

version: 1
rules:
- id: shallow
kind: max_directory_depth
paths: "**"
max_depth: 3
level: warning

alint check reports:

Terminal window
--- 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 failing

Every 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: 1
rules:
- id: shallow
kind: max_directory_depth
paths: "**"
max_depth: 3
level: warning

alint check reports:

Terminal window
v All 1 rule(s) passed.