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

pantsbuild / pants / 21042790249

15 Jan 2026 06:57PM UTC coverage: 43.263% (-35.4%) from 78.666%
21042790249

Pull #23021

github

web-flow
Merge cc03ad8de into d250c80fe
Pull Request #23021: WIP gh workflow scie pex

23 of 33 new or added lines in 3 files covered. (69.7%)

16147 existing lines in 521 files now uncovered.

26164 of 60477 relevant lines covered (43.26%)

0.87 hits per line

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

0.0
/src/python/pants/backend/cc/lint/clangformat/subsystem.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 __future__ import annotations
×
5

UNCOV
6
import os
×
UNCOV
7
from collections.abc import Iterable
×
8

UNCOV
9
from pants.backend.python.subsystems.python_tool_base import PythonToolBase
×
UNCOV
10
from pants.backend.python.target_types import ConsoleScript
×
UNCOV
11
from pants.core.goals.resolves import ExportableTool
×
UNCOV
12
from pants.core.util_rules.config_files import ConfigFilesRequest
×
UNCOV
13
from pants.engine.rules import Rule, collect_rules
×
UNCOV
14
from pants.engine.unions import UnionRule
×
UNCOV
15
from pants.option.option_types import ArgsListOption, SkipOption
×
UNCOV
16
from pants.util.strutil import help_text
×
17

18

UNCOV
19
class ClangFormat(PythonToolBase):
×
UNCOV
20
    options_scope = "clang-format"
×
UNCOV
21
    name = "ClangFormat"
×
UNCOV
22
    help_short = help_text(
×
23
        """
24
        The clang-format utility for formatting C/C++ (and others) code
25
        (https://clang.llvm.org/docs/ClangFormat.html). The clang-format binaries
26
        are retrieved from PyPi (https://pypi.org/project/clang-format/).
27
        """
28
    )
29

UNCOV
30
    default_main = ConsoleScript("clang-format")
×
UNCOV
31
    default_requirements = ["clang-format>=14.0.3,<16"]
×
32

UNCOV
33
    register_interpreter_constraints = True
×
34

UNCOV
35
    skip = SkipOption("fmt", "lint")
×
UNCOV
36
    args = ArgsListOption(example="--version")
×
37

UNCOV
38
    default_lockfile_resource = ("pants.backend.cc.lint.clangformat", "clangformat.lock")
×
39

UNCOV
40
    def config_request(self, dirs: Iterable[str]) -> ConfigFilesRequest:
×
41
        """clang-format will use the closest configuration file to the file currently being
42
        formatted, so add all of them."""
43
        config_files = (
×
44
            ".clang-format",
45
            "_clang-format",
46
        )
47
        check_existence = [os.path.join(d, file) for file in config_files for d in ("", *dirs)]
×
48
        return ConfigFilesRequest(
×
49
            discovery=True,
50
            check_existence=check_existence,
51
        )
52

53

UNCOV
54
def rules() -> Iterable[Rule | UnionRule]:
×
55
    return [
×
56
        *collect_rules(),
57
        UnionRule(ExportableTool, ClangFormat),
58
    ]
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