Verification · Hygiene
File hygiene
Cheap checks on files as files: valid syntax for config formats, no merge markers, no trailing whitespace, no oversized or binary blobs.
Sub-techniques
-
Config syntax validation
V1002.001Parse every JSON, YAML and TOML file, and validate the important ones against a schema.
-
Merge marker and whitespace checks
V1002.002Reject conflict markers, trailing whitespace and missing final newlines.
-
Large file guard
V1002.003Refuse files above a size limit so binaries go to LFS or object storage.
How to build it
- Add pre-commit-hooks with check-yaml, check-json, check-toml, check-merge-conflict and check-added-large-files.
- Validate CI and app config against published JSON schemas with check-jsonschema.
- Run pre-commit run --all-files in CI so the hooks are not optional.
Signals in a repository
- A .pre-commit-config.yaml listing pre-commit-hooks ids.
- A CI job that runs pre-commit run --all-files.
- A .yamllint or schema files referenced from hooks.