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

pantsbuild / pants / 25441711719

06 May 2026 02:31PM UTC coverage: 92.915%. Remained the same
25441711719

push

github

web-flow
use sha pin (with comment) format for generated actions (#23312)

Per the GitHub Action best practices we recently enabled at #23249, we
should pin each action to a SHA so that the reference is actually
immutable.

This will -- I hope -- knock out a large chunk of the 421 alerts we
currently get from zizmor. The next followup would then be upgrades and
harmonizing the generated and none-generated pins.

Notice: This idea was suggested by Claude while going over pinact output
and I was surprised to see that post processing the yaml wasn't too
gross.

92206 of 99237 relevant lines covered (92.91%)

4.04 hits per line

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

96.3
/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

4
from __future__ import annotations
1✔
5

6
import os
1✔
7
from collections.abc import Iterable
1✔
8

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

18
# pants: infer-dep(clangformat.lock*)
19

20

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

32
    default_main = ConsoleScript("clang-format")
1✔
33
    default_requirements = ["clang-format>=14.0.3,<16"]
1✔
34

35
    register_interpreter_constraints = True
1✔
36

37
    skip = SkipOption("fmt", "lint")
1✔
38
    args = ArgsListOption(example="--version")
1✔
39

40
    default_lockfile_resource = ("pants.backend.cc.lint.clangformat", "clangformat.lock")
1✔
41

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

55

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