• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pmd / pmd / 811
80%

Build:
DEFAULT BRANCH: main
Ran 17 Sep 2026 01:32PM UTC
Jobs 1
Files 2219
Run time 5min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

17 Sep 2026 01:00PM UTC coverage: 79.638% (+0.09%) from 79.545%
811

push

github

web-flow
[kotlin] Add XPath functions and type attributes (#6893)

Adds XPath function and attribute support to pmd-kotlin, enabling type-aware XPath rules.

## What's included

**7 XPath functions** (`pmd-kotlin:` namespace):
- `typeIs(typeName)` / `typeIsExactly(typeName)` — type checks (with/without subtypes)
- `matchesSig(signature)` — match function/constructor call signatures
- `hasAnnotation(fqn)` — check annotation presence
- `modifiers()` — get modifier keywords
- `isNullable()` — nullable type check
- `hasUnresolvedReference()` — whether a node has an unresolved type reference

**Type-info XPath attributes** (need `auxClasspath` + resolved types; absent otherwise):

| Attribute | Nodes | Meaning |
|---|---|---|
| `@TypeName` | ClassDeclaration, PropertyDeclaration, ClassParameter, DelegationSpecifier, CatchBlock, ForStatement, SingleAnnotation, UnescapedAnnotation, FunctionValueParameter | FQ type name (with generics + nullable marker) |
| `@ReturnTypeName` | FunctionDeclaration | FQ return type name |
| `@AnnotationFqNames` | ClassDeclaration, FunctionDeclaration, PropertyDeclaration, ClassParameter | FQNs of all annotations (always present, empty list if none) |

**General (structural) XPath attributes** — always present, don't depend on type resolution:

| Attribute | Nodes | Meaning |
|---|---|---|
| `@Identifier` | ClassDeclaration, FunctionDeclaration, ClassParameter, CompanionObject, VariableDeclaration, ImportAlias | Simple name of the declared identifier |
| `@Mutable` | PropertyDeclaration | `true`/`false` for `var`/`val` |
| `@Name` | ImportHeader | Fully-qualified imported name |

Note: modifiers are **not** exposed as an `@Modifiers` XPath attribute — use `pmd-kotlin:modifiers()`
instead. `HasModifiers.getModifiers()` remains available for Java-based rules.

**`KotlinTypeName` type abstraction.**
Type info is stored as `KotlinTypeName` objects (PMD-owned, immutable), decoupling the public API
from kotlin-type-mapper, which stays an inter... (continued)

20027 of 26160 branches covered (76.56%)

Branch coverage included in aggregate %.

392 of 434 new or added lines in 34 files covered. (90.32%)

43141 of 53159 relevant lines covered (81.15%)

0.82 hits per line

Uncovered Changes

Lines Coverage ∆ File
16
43.08
pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/rule/xpath/internal/KotlinIsNullableFunction.java
7
84.26
pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/rule/xpath/internal/KotlinMatchesSigFunction.java
4
89.84
20.03% pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/rule/internal/KotlinTypeAnalysisContext.java
3
81.67
pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/rule/xpath/internal/AbstractKotlinTypeIsFunctionCall.java
2
88.89
-5.05% pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/KotlinLanguageProcessor.java
2
0.0
pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/ast/KtSingleAnnotationAttributes.java
2
80.0
pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/types/KotlinTypeName.java
1
63.92
20.44% pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/ast/AttributeView.java
1
83.33
pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/ast/KtFunctionValueParameterAttributes.java
1
97.06
pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/rule/xpath/internal/KotlinHasAnnotationFunction.java
1
89.47
pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/rule/xpath/internal/KotlinHasUnresolvedReferenceFunction.java
1
87.5
pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/rule/xpath/internal/KotlinModifiersFunction.java
1
89.47
pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/rule/xpath/internal/KotlinTypeIsFunction.java
Jobs
ID Job ID Ran Files Coverage
1 811.1 17 Sep 2026 01:32PM UTC 2219
79.64
GitHub Action Run
Source Files on build 811
  • Tree
  • List 2219
  • Changed 21
  • Source Changed 20
  • Coverage Changed 20
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #811
  • 5bc929ee on github
  • Prev Build on main (#810)
  • Next Build on main (#812)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc