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

pantsbuild / pants / 21552830208

31 Jan 2026 11:40PM UTC coverage: 80.277% (-0.05%) from 80.324%
21552830208

Pull #23062

github

web-flow
Merge 808a9786c into 2c4dcf9cf
Pull Request #23062: Remove support for Get

18 of 25 new or added lines in 4 files covered. (72.0%)

17119 existing lines in 541 files now uncovered.

78278 of 97510 relevant lines covered (80.28%)

3.36 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

48.72
/src/python/pants/backend/openapi/util_rules/pom_parser.py
1
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3

UNCOV
4
from __future__ import annotations
2✔
5

UNCOV
6
import xml.etree.ElementTree as ET
2✔
UNCOV
7
from dataclasses import dataclass
2✔
8

UNCOV
9
from pants.engine.fs import Digest
2✔
UNCOV
10
from pants.engine.intrinsics import get_digest_contents
2✔
UNCOV
11
from pants.engine.rules import collect_rules, rule
2✔
UNCOV
12
from pants.jvm.resolve.coordinate import Coordinate
2✔
13

14

UNCOV
15
@dataclass(frozen=True)
2✔
UNCOV
16
class AnalysePomRequest:
2✔
UNCOV
17
    pom_digest: Digest
2✔
18

19

UNCOV
20
@dataclass(frozen=True)
2✔
UNCOV
21
class PomReport:
2✔
UNCOV
22
    dependencies: tuple[Coordinate, ...]
2✔
23

24

UNCOV
25
_MAVEN_NAMESPACE = "http://maven.apache.org/POM/4.0.0"
2✔
UNCOV
26
_MAVEN_NAMESPACE_MAP = {"mvn": _MAVEN_NAMESPACE}
2✔
27

28

UNCOV
29
@rule(desc="Analysing Maven POM file")
2✔
UNCOV
30
async def analyse_pom(request: AnalysePomRequest) -> PomReport:
2✔
31
    contents = await get_digest_contents(request.pom_digest)
×
32
    assert len(contents) == 1
×
33

34
    root = ET.fromstring(contents[0].content)
×
35

36
    def maybe_lookup_property(txt: str | None) -> str | None:
×
37
        if not txt:
×
38
            return None
×
39

40
        if txt.startswith("${") and txt.endswith("}"):
×
41
            prop = txt[2:-1]
×
42
            prop_value = root.findtext(
×
43
                f".//mvn:properties/mvn:{prop}", namespaces=_MAVEN_NAMESPACE_MAP
44
            )
45
            if prop_value:
×
46
                return prop_value
×
47
        return txt
×
48

49
    coordinates = []
×
50
    for dep in root.findall(".//mvn:dependency", namespaces=_MAVEN_NAMESPACE_MAP):
×
51
        scope = maybe_lookup_property(dep.findtext("mvn:scope", namespaces=_MAVEN_NAMESPACE_MAP))
×
52
        if scope and scope == "test":
×
53
            continue
×
54

55
        coord_dict = {
×
56
            "artifact": maybe_lookup_property(
57
                dep.findtext("mvn:artifactId", namespaces=_MAVEN_NAMESPACE_MAP)
58
            ),
59
            "group": maybe_lookup_property(
60
                dep.findtext("mvn:groupId", namespaces=_MAVEN_NAMESPACE_MAP)
61
            ),
62
            "version": maybe_lookup_property(
63
                dep.findtext("mvn:version", namespaces=_MAVEN_NAMESPACE_MAP)
64
            ),
65
            "packaging": maybe_lookup_property(
66
                dep.findtext("mvn:packaging", default="jar", namespaces=_MAVEN_NAMESPACE_MAP)
67
            ),
68
            "classifier": maybe_lookup_property(
69
                dep.findtext("mvn:classifier", namespaces=_MAVEN_NAMESPACE_MAP)
70
            ),
71
        }
72
        coordinates.append(Coordinate.from_json_dict(coord_dict))
×
73

74
    return PomReport(tuple(coordinates))
×
75

76

UNCOV
77
def rules():
2✔
UNCOV
78
    return collect_rules()
2✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc