Skip to main content

Crate alint_rules

Crate alint_rules 

Source
Expand description

Built-in rule implementations for alint.

Rules are registered into an alint_core::RuleRegistry via register_builtin. Each kind has its own submodule.

Modules§

case
Case-convention detectors used by filename_case and path_case.
dir_absent
dir_absent — no directory matching paths may exist.
dir_contains
dir_contains — every directory matching select must have at least one direct child matching each glob in require. Sugar over for_each_dir + file_exists for the common shape “this dir must have X, Y, and Z.”
dir_exists
dir_exists — at least one directory matching paths must exist.
dir_only_contains
dir_only_contains — every direct child file of a directory matching select: must match at least one glob in allow:. Subdirectories are not checked (use dir_absent if you need to forbid nested directories).
every_matching_has
every_matching_has — every file OR directory matching select must satisfy every rule in require. Sugar over for_each_file + for_each_dir: one rule that iterates both entry kinds so users who don’t care whether a glob matches files or dirs can write a single rule instead of two.
file_absent
file_absent — emit a violation for every file matching paths.
file_content_forbidden
file_content_forbidden — files in scope must NOT match a regex.
file_content_matches
file_content_matches — every file in scope must match a regex.
file_exists
file_exists — require that at least one file matching any of the given globs exists in the repository.
file_header
file_header — first N lines of each file in scope must match a pattern.
file_is_text
file_is_text — every file in scope must be detected as text (not binary).
file_max_size
file_max_size — files in scope must be at most max_bytes bytes.
filename_case
filename_case — every file in scope must have a basename whose stem matches a case convention.
filename_regex
filename_regex — every file in scope must have a basename matching a regex. Anchored with ^...$ automatically; use the full basename (including extension) in your pattern.
fixers
Shared Fixer implementations.
for_each_dir
for_each_dir — iterate over every directory matching select: and evaluate a nested require: block against each. Path-template tokens in the nested specs are pre-substituted per iteration using the iterated directory as the anchor.
for_each_file
for_each_file — iterate over every file matching select: and evaluate a nested require: block against each. Same mechanics as crate::for_each_dir — differs only in iterating files instead of directories from the FileIndex.
io
Shared I/O helpers for content-reading rules.
pair
pair — for every file matching primary, require a file matching the partner template to exist somewhere in the tree.
unique_by
unique_by — flag any group of files (matching select:) that share the same rendered key. The key is a path template evaluated per matched file; default is {basename} (catches any two files with the same name regardless of directory).

Functions§

builtin_registry
Convenience constructor that returns a fresh registry pre-populated with every built-in rule.
register_builtin
Register every built-in rule kind into the given registry.