ini_path_matches
Same shape as the *_equals variants, but the asserted value is a regex matched against string values. Non-string matches produce a clear “value is not a string” violation.
Options
Section titled “Options”| Option | Type | Required | Default | Description |
|---|---|---|---|---|
if_present | boolean | false | When true, a query returning zero matches is silently OK - only real matches that fail the op produce violations. | |
matches | string | yes | Rust-regex pattern to match against the value at path. | |
path | string | yes | JSONPath expression rooted at $. |
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”An .ini JDBC url on the wrong engine
Section titled “An .ini JDBC url on the wrong engine”The rule fires on this repository:
config.ini[database]url = jdbc:mysql://localhost/appWith this .alint.yml:
version: 1rules: - id: postgres-only kind: ini_path_matches paths: "config.ini" path: "$['database']['url']" matches: "^jdbc:postgresql:" level: erroralint check reports:
--- config.ini ----------------------------------------------------------------- x error postgres-only value at path "jdbc:mysql://localhost/app" does not match regex ^jdbc:postgresql:
Summary (1 violation): x 1 error 0 passing * 1 failingA tox.ini with a multi-line deps value
Section titled “A tox.ini with a multi-line deps value”This repository is compliant:
tox.ini[testenv]deps = pytest coveragecommands = pytestWith this .alint.yml:
version: 1rules: - id: deps-includes-pytest kind: ini_path_matches paths: "tox.ini" path: "$['testenv']['deps']" matches: "pytest" level: erroralint check reports:
v All 1 rule(s) passed.An .ini JDBC url on postgres
Section titled “An .ini JDBC url on postgres”This repository is compliant:
config.ini[database]url = jdbc:postgresql://localhost/appWith this .alint.yml:
version: 1rules: - id: postgres-only kind: ini_path_matches paths: "config.ini" path: "$['database']['url']" matches: "^jdbc:postgresql:" level: erroralint check reports:
v All 1 rule(s) passed.