• 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/build_files/fmt/buildifier/rules.py
1
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3

UNCOV
4
from pants.backend.build_files.fmt.base import FmtBuildFilesRequest
×
UNCOV
5
from pants.backend.build_files.fmt.buildifier.subsystem import Buildifier
×
UNCOV
6
from pants.core.goals.fmt import AbstractFmtRequest, FmtResult
×
UNCOV
7
from pants.core.goals.resolves import ExportableTool
×
UNCOV
8
from pants.core.util_rules.external_tool import download_external_tool
×
UNCOV
9
from pants.engine.internals.native_engine import MergeDigests
×
UNCOV
10
from pants.engine.intrinsics import merge_digests
×
UNCOV
11
from pants.engine.platform import Platform
×
UNCOV
12
from pants.engine.process import Process, fallible_to_exec_result_or_raise
×
UNCOV
13
from pants.engine.rules import collect_rules, implicitly, rule
×
UNCOV
14
from pants.engine.unions import UnionRule
×
UNCOV
15
from pants.util.logging import LogLevel
×
UNCOV
16
from pants.util.strutil import pluralize
×
17

18

UNCOV
19
class BuildifierRequest(FmtBuildFilesRequest):
×
UNCOV
20
    tool_subsystem = Buildifier  # type: ignore[assignment]
×
21

22

UNCOV
23
async def _run_buildifier_fmt(
×
24
    request: AbstractFmtRequest.Batch, buildifier: Buildifier, platform: Platform
25
) -> FmtResult:
26
    buildifier_tool = await download_external_tool(buildifier.get_request(platform))
×
27
    input_digest = await merge_digests(
×
28
        MergeDigests((request.snapshot.digest, buildifier_tool.digest))
29
    )
30
    result = await fallible_to_exec_result_or_raise(
×
31
        **implicitly(
32
            Process(
33
                argv=[buildifier_tool.exe, "-type=build", *request.files],
34
                input_digest=input_digest,
35
                output_files=request.files,
36
                description=f"Run {Buildifier.options_scope} on {pluralize(len(request.files), 'file')}.",
37
                level=LogLevel.DEBUG,
38
            )
39
        ),
40
    )
41
    return await FmtResult.create(request, result)
×
42

43

UNCOV
44
@rule(desc="Format with Buildifier", level=LogLevel.DEBUG)
×
UNCOV
45
async def buildifier_fmt(
×
46
    request: BuildifierRequest.Batch, buildifier: Buildifier, platform: Platform
47
) -> FmtResult:
48
    result = await _run_buildifier_fmt(request, buildifier, platform)
×
49
    return result
×
50

51

UNCOV
52
def rules():
×
UNCOV
53
    return [
×
54
        *collect_rules(),
55
        *BuildifierRequest.rules(),
56
        UnionRule(ExportableTool, Buildifier),
57
    ]
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