pair
For every file matching primary, a file matching the partner template must exist.
Options
Section titled “Options”| Option | Type | Required | Default | Description |
|---|---|---|---|---|
partner | string | yes | Path template resolved per primary match. Example: “{dir}/{stem}.h”. | |
primary | string | yes | Glob selecting the primary files. |
Plus the common level, id, and when fields. This rule analyses the whole repository, so it takes no paths. This table is generated from the JSON Schema; option types and defaults are authoritative.
Example
Section titled “Example”A C source file with no matching header
Section titled “A C source file with no matching header”The rule fires on this repository:
src/src/alpha.csrc/alpha.hsrc/beta.cint a;int a;int b;With this .alint.yml:
version: 1rules: - id: c-requires-h kind: pair primary: "src/**/*.c" partner: "{dir}/{stem}.h" level: erroralint check reports:
--- src/beta.c ----------------------------------------------------------------- x error c-requires-h src/beta.c has no matching partner at src/beta.h (template: {dir}/{stem}.h)
Summary (1 violation): x 1 error 0 passing * 1 failingEvery C source file has its header partner
Section titled “Every C source file has its header partner”This repository is compliant:
src/src/alpha.csrc/alpha.hsrc/beta.csrc/beta.hint a;int a;int b;int b;With this .alint.yml:
version: 1rules: - id: c-requires-h kind: pair primary: "src/**/*.c" partner: "{dir}/{stem}.h" level: erroralint check reports:
v All 1 rule(s) passed.