topmark.filetypes.filename_rules¶
topmark / filetypes / filename_rules
Normalize and validate file type filename rules.
FileType.filenames entries are declarative registry matching rules, not
filesystem paths. Rules are stored as canonical POSIX-style strings so registry
output and resolver behavior stay stable across platforms.
A rule may be either an exact basename such as Makefile or a relative
tail-subpath such as .vscode/settings.json. Backslashes are accepted as
compatibility input and normalized to /; absolute paths, drive paths, UNC
paths, empty segments, and . / .. segments are rejected.
normalize_filename_rules ¶
Return canonical POSIX-style filename rules.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rules
|
Iterable[str]
|
Exact basename and relative tail-subpath filename rules to normalize. |
required |
file_type
|
str
|
Qualified file type identifier used in validation errors. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Canonical filename rules using |
Invalid rules are rejected by the single-rule normalizer before any canonical value is returned.