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

pantsbuild / pants / 19015773527

02 Nov 2025 05:33PM UTC coverage: 17.872% (-62.4%) from 80.3%
19015773527

Pull #22816

github

web-flow
Merge a12d75757 into 6c024e162
Pull Request #22816: Update Pants internal Python to 3.14

4 of 5 new or added lines in 3 files covered. (80.0%)

28452 existing lines in 683 files now uncovered.

9831 of 55007 relevant lines covered (17.87%)

0.18 hits per line

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

0.0
/src/python/pants/backend/tools/taplo/rules.py
1
# Copyright 2023 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3

UNCOV
4
from typing import Any
×
5

UNCOV
6
from pants.backend.tools.taplo.subsystem import Taplo
×
UNCOV
7
from pants.core.goals.fmt import FmtFilesRequest, FmtResult, Partitions
×
UNCOV
8
from pants.core.goals.resolves import ExportableTool
×
UNCOV
9
from pants.core.util_rules.config_files import find_config_file
×
UNCOV
10
from pants.core.util_rules.external_tool import download_external_tool
×
UNCOV
11
from pants.engine.fs import MergeDigests
×
UNCOV
12
from pants.engine.intrinsics import merge_digests
×
UNCOV
13
from pants.engine.platform import Platform
×
UNCOV
14
from pants.engine.process import Process, execute_process_or_raise
×
UNCOV
15
from pants.engine.rules import collect_rules, concurrently, implicitly, rule
×
UNCOV
16
from pants.engine.unions import UnionRule
×
UNCOV
17
from pants.source.filespec import FilespecMatcher
×
UNCOV
18
from pants.util.logging import LogLevel
×
UNCOV
19
from pants.util.strutil import pluralize
×
20

21

UNCOV
22
class TaploFmtRequest(FmtFilesRequest):
×
UNCOV
23
    tool_subsystem = Taplo  # type: ignore[assignment]
×
24

25

UNCOV
26
@rule
×
UNCOV
27
async def partition_inputs(
×
28
    request: TaploFmtRequest.PartitionRequest, taplo: Taplo
29
) -> Partitions[Any]:
30
    if taplo.skip or not request.files:
×
31
        return Partitions()
×
32

33
    matched_filepaths = FilespecMatcher(
×
34
        includes=[
35
            (glob[2:] if glob.startswith(r"\\!") else glob)
36
            for glob in taplo.glob_pattern
37
            if not glob.startswith("!")
38
        ],
39
        excludes=[glob[1:] for glob in taplo.glob_pattern if glob.startswith("!")],
40
    ).matches(tuple(request.files))
41

42
    return Partitions.single_partition(sorted(matched_filepaths))
×
43

44

UNCOV
45
@rule(desc="Format with taplo", level=LogLevel.DEBUG)
×
UNCOV
46
async def taplo_fmt(request: TaploFmtRequest.Batch, taplo: Taplo, platform: Platform) -> FmtResult:
×
47
    download_taplo_get = download_external_tool(taplo.get_request(platform))
×
48
    config_files_get = find_config_file(taplo.config_request())
×
49
    downloaded_taplo, config_digest = await concurrently(download_taplo_get, config_files_get)
×
50
    input_digest = await merge_digests(
×
51
        MergeDigests(
52
            (request.snapshot.digest, downloaded_taplo.digest, config_digest.snapshot.digest)
53
        )
54
    )
55

56
    argv = (
×
57
        downloaded_taplo.exe,
58
        "fmt",
59
        *taplo.args,
60
        *request.files,
61
    )
62
    result = await execute_process_or_raise(
×
63
        **implicitly(
64
            Process(
65
                argv=argv,
66
                input_digest=input_digest,
67
                output_files=request.files,
68
                description=f"Run taplo on {pluralize(len(request.files), 'file')}.",
69
                level=LogLevel.DEBUG,
70
            )
71
        )
72
    )
73
    return await FmtResult.create(request, result)
×
74

75

UNCOV
76
def rules():
×
UNCOV
77
    return (
×
78
        *collect_rules(),
79
        *TaploFmtRequest.rules(),
80
        UnionRule(ExportableTool, Taplo),
81
    )
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