• 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/typescript/goals/tailor.py
1
# Copyright 2023 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3
import dataclasses
1✔
4
from collections.abc import Iterable
1✔
5
from dataclasses import dataclass
1✔
6

7
from pants.backend.typescript.target_types import (
1✔
8
    TS_FILE_EXTENSIONS,
9
    TypeScriptSourcesGeneratorTarget,
10
    TypeScriptTestsGeneratorSourcesField,
11
    TypeScriptTestsGeneratorTarget,
12
)
13
from pants.core.goals.tailor import (
1✔
14
    AllOwnedSources,
15
    PutativeTarget,
16
    PutativeTargets,
17
    PutativeTargetsRequest,
18
)
19
from pants.core.util_rules.ownership import get_unowned_files_for_globs
1✔
20
from pants.core.util_rules.source_files import classify_files_for_sources_and_tests
1✔
21
from pants.engine.rules import Rule, collect_rules, rule
1✔
22
from pants.engine.unions import UnionRule
1✔
23
from pants.util.dirutil import group_by_dir
1✔
24
from pants.util.logging import LogLevel
1✔
25

26

27
@dataclass(frozen=True)
1✔
28
class PutativeTypeScriptTargetsRequest(PutativeTargetsRequest):
1✔
29
    pass
1✔
30

31

32
_LOG_DESCRIPTION_TEMPLATE = "Determine candidate {} to create"
1✔
33

34

35
@rule(level=LogLevel.DEBUG, desc=_LOG_DESCRIPTION_TEMPLATE.format("TypeScript targets"))
1✔
36
async def find_putative_ts_targets(
1✔
37
    req: PutativeTypeScriptTargetsRequest, all_owned_sources: AllOwnedSources
38
) -> PutativeTargets:
39
    unowned_ts_files = await get_unowned_files_for_globs(
1✔
40
        req, all_owned_sources, (f"*{ext}" for ext in TS_FILE_EXTENSIONS)
41
    )
42
    classified_unowned_ts_files = classify_files_for_sources_and_tests(
1✔
43
        paths=unowned_ts_files,
44
        test_file_glob=TypeScriptTestsGeneratorSourcesField.default,
45
        sources_generator=TypeScriptSourcesGeneratorTarget,
46
        tests_generator=TypeScriptTestsGeneratorTarget,
47
    )
48

49
    return PutativeTargets(
1✔
50
        PutativeTarget.for_target_type(
51
            tgt_type, path=dirname, name=name, triggering_sources=sorted(filenames)
52
        )
53
        for tgt_type, paths, name in (dataclasses.astuple(f) for f in classified_unowned_ts_files)
54
        for dirname, filenames in group_by_dir(paths).items()
55
    )
56

57

58
def rules() -> Iterable[Rule | UnionRule]:
1✔
59
    return (
1✔
60
        *collect_rules(),
61
        UnionRule(PutativeTargetsRequest, PutativeTypeScriptTargetsRequest),
62
    )
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