Skip to content

max_files_per_directory

Per-directory fanout may not exceed max_files. Useful for vendor directories that accidentally grow to thousands of entries.

OptionTypeRequiredDefaultDescription
max_filesinteger (>= 1)yesMaximum number of in-scope files allowed as immediate children of any one directory (non-recursive).

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

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/
packages/a.md
packages/b.md
packages/c.md
packages/d.md

With this .alint.yml:

version: 1
rules:
- id: cap
kind: max_files_per_directory
paths: "**/*.md"
max_files: 2
level: warning

alint check reports:

Terminal window
--- packages -------------------------------------------------------------------
! warning cap
packages has 4 files; max is 2
Summary (1 violation):
! 1 warning
0 passing * 1 failing

Every 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: 1
rules:
- id: cap
kind: max_files_per_directory
paths: "**/*.md"
max_files: 5
level: warning

alint check reports:

Terminal window
v All 1 rule(s) passed.