Skip to content

dir_exists

Directory counterpart of file_exists. Every match must correspond to a real directory in the walked tree.

Optional root_only: true (like file_exists) requires the match to be a directory directly at the repository root, not nested. Optional git_tracked_only: true further requires that the directory contain at least one tracked file. A tree with a docs/ checked out from a stale clone where every file was later removed via git rm would fail under this stricter check. See The walker and .gitignore for the full semantics.

OptionTypeRequiredDefaultDescription
git_tracked_onlybooleanfalseRestrict matches to directories that contain at least one git-tracked file. No effect outside a git repo. Default false.
root_onlybooleanfalseIf true, only a directory directly at the repository root satisfies the rule; a nested match does not.

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

The rule fires on this repository:

Cargo.toml

With this .alint.yml:

version: 1
rules:
- id: has-src
kind: dir_exists
paths: "src"
level: error

This repository is compliant:

Cargo.toml
src/
src/main.rs

With this .alint.yml:

version: 1
rules:
- id: has-src
kind: dir_exists
paths: "src"
level: error