Skip to content

xml_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.

OptionTypeRequiredDefaultDescription
if_presentbooleanfalseWhen true, a query returning zero matches is silently OK - only real matches that fail the op produce violations.
matchesstringyesRust-regex pattern to match against the value at path.
pathstringyesJSONPath 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.

A Maven dependency whose version is not a concrete release

Section titled “A Maven dependency whose version is not a concrete release”

The rule fires on this repository:

pom.xml
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<dependencies>
<dependency><artifactId>guava</artifactId><version>33.0.0-jre</version></dependency>
<dependency><artifactId>internal</artifactId><version>${revision}</version></dependency>
</dependencies>
</project>

With this .alint.yml:

version: 1
rules:
- id: pom-deps-pinned
kind: xml_path_matches
paths: "pom.xml"
path: "$.project.dependencies.dependency[*].version"
matches: '^\d'
level: error

alint check reports:

Terminal window
--- pom.xml --------------------------------------------------------------------
x error pom-deps-pinned
value at path "${revision}" does not match regex ^\d
Summary (1 violation):
x 1 error
0 passing * 1 failing

Every Maven dependency declares a concrete version

Section titled “Every Maven dependency declares a concrete version”

This repository is compliant:

pom.xml
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<dependencies>
<dependency><groupId>com.google.guava</groupId><artifactId>guava</artifactId><version>33.0.0-jre</version></dependency>
<dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.13.2</version></dependency>
</dependencies>
</project>

With this .alint.yml:

version: 1
rules:
- id: pom-deps-versioned
kind: xml_path_matches
paths: "pom.xml"
path: "$.project.dependencies.dependency[*].version"
matches: '^\d'
level: error

alint check reports:

Terminal window
v All 1 rule(s) passed.