file_content_matches
File contents must contain at least one match for a regex.
Fix: file_append — append declared content.
Options
Section titled “Options”| Option | Type | Required | Default | Description |
|---|---|---|---|---|
pattern | string | yes | Rust regex. File contents must match. |
Plus the common paths, level, id, and when fields. This table is generated from the JSON Schema; option types and defaults are authoritative.
Example
Section titled “Example”A README missing its SPDX license tag
Section titled “A README missing its SPDX license tag”The rule fires on this repository:
README.md# Project
A short description.With this .alint.yml:
version: 1rules: - id: spdx-in-readme kind: file_content_matches paths: "README.md" pattern: "SPDX-License-Identifier" level: warningalint check reports:
--- README.md ------------------------------------------------------------------ ! warning spdx-in-readme content does not match required pattern /SPDX-License-Identifier/
Summary (1 violation): ! 1 warning 0 passing * 1 failingA README that declares its SPDX license
Section titled “A README that declares its SPDX license”This repository is compliant:
README.md# Project
SPDX-License-Identifier: Apache-2.0
A short description.With this .alint.yml:
version: 1rules: - id: spdx-in-readme kind: file_content_matches paths: "README.md" pattern: "SPDX-License-Identifier" level: warningalint check reports:
v All 1 rule(s) passed.