• 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

100.0
/src/python/pants/backend/project_info/list_targets.py
1
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3

4
import logging
6✔
5
from typing import cast
6✔
6

7
from pants.engine.addresses import Address, Addresses
6✔
8
from pants.engine.console import Console
6✔
9
from pants.engine.goal import Goal, GoalSubsystem, LineOriented
6✔
10
from pants.engine.internals.graph import resolve_unexpanded_targets
6✔
11
from pants.engine.rules import collect_rules, goal_rule
6✔
12
from pants.engine.target import DescriptionField
6✔
13
from pants.option.option_types import BoolOption
6✔
14

15
logger = logging.getLogger(__name__)
6✔
16

17

18
class ListSubsystem(LineOriented, GoalSubsystem):
6✔
19
    name = "list"
6✔
20
    help = "Lists all targets matching the file or target arguments."
6✔
21

22
    documented = BoolOption(
6✔
23
        default=False,
24
        help="Print only targets that are documented with a description.",
25
    )
26

27

28
class List(Goal):
6✔
29
    subsystem_cls = ListSubsystem
6✔
30
    environment_behavior = Goal.EnvironmentBehavior.LOCAL_ONLY
6✔
31

32

33
@goal_rule
6✔
34
async def list_targets(
6✔
35
    addresses: Addresses, list_subsystem: ListSubsystem, console: Console
36
) -> List:
37
    if not addresses:
2✔
38
        logger.warning(f"No targets were matched in goal `{list_subsystem.name}`.")
2✔
39
        return List(exit_code=0)
2✔
40

41
    if list_subsystem.documented:
2✔
42
        # We must preserve target generators, not replace with their generated targets.
43
        targets = await resolve_unexpanded_targets(addresses)
1✔
44
        addresses_with_descriptions = cast(
1✔
45
            dict[Address, str],
46
            {
47
                tgt.address: tgt[DescriptionField].value
48
                for tgt in targets
49
                if tgt.get(DescriptionField).value is not None
50
            },
51
        )
52
        with list_subsystem.line_oriented(console) as print_stdout:
1✔
53
            for address, description in addresses_with_descriptions.items():
1✔
54
                formatted_description = "\n  ".join(description.strip().split("\n"))
1✔
55
                print_stdout(f"{address.spec}\n  {formatted_description}")
1✔
56
        return List(exit_code=0)
1✔
57

58
    with list_subsystem.line_oriented(console) as print_stdout:
2✔
59
        for address in sorted(addresses):
2✔
60
            print_stdout(address.spec)
2✔
61
    return List(exit_code=0)
2✔
62

63

64
def rules():
6✔
65
    return collect_rules()
5✔
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