Skip to content

file_ends_with

Byte-level prefix / suffix check. Works on any bytes (binary safe, unlike file_header).

Check-only: a fix would risk silently duplicating a near-matching prefix. Pair with file_prepend / file_append explicitly if you want auto-repair.

OptionTypeRequiredDefaultDescription
suffixstringyesRequired suffix, matched byte-for-byte.

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

Generated files missing their sentinel line

Section titled “Generated files missing their sentinel line”

The rule fires on this repository:

build/
build/ok.generated.md
build/stripped.generated.md
build/wrong_tail.generated.md
build/ok.generated.md
# hi
<!-- generated by alint -->
build/stripped.generated.md
# hi
build/wrong_tail.generated.md
# hi
<!-- generated by somebody else -->

With this .alint.yml:

version: 1
rules:
- id: gen-sentinel
kind: file_ends_with
paths: "build/**/*.generated.md"
suffix: "<!-- generated by alint -->\n"
level: error

alint check reports:

Terminal window
--- build/stripped.generated.md ------------------------------------------------
x error gen-sentinel
file does not end with the required suffix
--- build/wrong_tail.generated.md ----------------------------------------------
x error gen-sentinel
file does not end with the required suffix
Summary (2 violations):
x 2 errors
0 passing * 1 failing

Every generated file ends with the sentinel

Section titled “Every generated file ends with the sentinel”

This repository is compliant:

build/
build/a.generated.md
build/b.generated.md
build/a.generated.md
# hi
<!-- generated by alint -->
build/b.generated.md
# world
<!-- generated by alint -->

With this .alint.yml:

version: 1
rules:
- id: gen-sentinel
kind: file_ends_with
paths: "build/**/*.generated.md"
suffix: "<!-- generated by alint -->\n"
level: error

alint check reports:

Terminal window
v All 1 rule(s) passed.