max_files_per_directory
Per-directory fanout may not exceed max_files. Useful for vendor directories that accidentally grow to thousands of entries.
Options
Section titled "Options"| Option | Type | Required | Default | Description |
|---|---|---|---|---|
max_files | integer (>= 1) | yes | Maximum number of in-scope files allowed as immediate children of any one directory (non-recursive). |
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 directory holding more files than the cap allows
Section titled "A directory holding more files than the cap allows"The rule fires on this repository:
- other/
- other/single.md✓
- packages/
⚠ warning cap
packages has 4 files; max is 2
- packages/a.md✓
- packages/b.md✓
- packages/c.md✓
- packages/d.md✓
With this .alint.yml:
version: 1rules: - id: cap kind: max_files_per_directory paths: "**/*.md" max_files: 2 level: warningalint check reports:
--- packages ------------------------------------------------------------------- ! warning cap packages has 4 files; max is 2
Summary (1 violation): ! 1 warning 0 passing * 1 failingEvery directory stays under the file-count cap
Section titled "Every directory stays under the file-count cap"This repository is compliant:
- docs/
- docs/a.md✓
- docs/b.md✓
- src/
- src/c.md✓
With this .alint.yml:
version: 1rules: - id: cap kind: max_files_per_directory paths: "**/*.md" max_files: 5 level: warningalint check reports:
v All 1 rule(s) passed.