• 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/python/lint/pydocstyle/rules.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
3✔
5

6
from pants.backend.python.lint.pydocstyle.subsystem import Pydocstyle, PydocstyleFieldSet
3✔
7
from pants.backend.python.util_rules import pex
3✔
8
from pants.backend.python.util_rules.pex import VenvPexProcess, create_venv_pex
3✔
9
from pants.core.goals.lint import LintResult, LintTargetsRequest
3✔
10
from pants.core.util_rules.config_files import find_config_file
3✔
11
from pants.core.util_rules.partitions import PartitionerType
3✔
12
from pants.core.util_rules.source_files import (
3✔
13
    SourceFiles,
14
    SourceFilesRequest,
15
    determine_source_files,
16
)
17
from pants.engine.fs import MergeDigests
3✔
18
from pants.engine.intrinsics import execute_process, merge_digests
3✔
19
from pants.engine.rules import collect_rules, concurrently, implicitly, rule
3✔
20
from pants.util.logging import LogLevel
3✔
21
from pants.util.strutil import pluralize
3✔
22

23

24
class PydocstyleRequest(LintTargetsRequest):
3✔
25
    field_set_type = PydocstyleFieldSet
3✔
26
    tool_subsystem = Pydocstyle  # type: ignore[assignment]
3✔
27
    partitioner_type = PartitionerType.DEFAULT_SINGLE_PARTITION
3✔
28

29

30
def generate_argv(source_files: SourceFiles, pydocstyle: Pydocstyle) -> tuple[str, ...]:
3✔
31
    args: list[str] = []
3✔
32
    if pydocstyle.config is not None:
3✔
33
        args.append(f"--config={pydocstyle.config}")
1✔
34
    args.extend(pydocstyle.args)
3✔
35
    args.extend(source_files.files)
3✔
36
    return tuple(args)
3✔
37

38

39
@rule(desc="Lint with Pydocstyle", level=LogLevel.DEBUG)
3✔
40
async def pydocstyle_lint(
3✔
41
    request: PydocstyleRequest.Batch,
42
    pydocstyle: Pydocstyle,
43
) -> LintResult:
44
    pydocstyle_pex_get = create_venv_pex(**implicitly(pydocstyle.to_pex_request()))
3✔
45
    config_files_get = find_config_file(pydocstyle.config_request)
3✔
46
    source_files_get = determine_source_files(
3✔
47
        SourceFilesRequest(field_set.source for field_set in request.elements)
48
    )
49

50
    pydocstyle_pex, config_files, source_files = await concurrently(
3✔
51
        pydocstyle_pex_get, config_files_get, source_files_get
52
    )
53

54
    input_digest = await merge_digests(
3✔
55
        MergeDigests((source_files.snapshot.digest, config_files.snapshot.digest))
56
    )
57
    result = await execute_process(
3✔
58
        **implicitly(
59
            VenvPexProcess(
60
                pydocstyle_pex,
61
                argv=generate_argv(source_files, pydocstyle),
62
                input_digest=input_digest,
63
                description=f"Run Pydocstyle on {pluralize(len(request.elements), 'file')}.",
64
                level=LogLevel.DEBUG,
65
            )
66
        )
67
    )
68
    return LintResult.create(request, result)
3✔
69

70

71
def rules():
3✔
72
    return (
3✔
73
        *collect_rules(),
74
        *PydocstyleRequest.rules(),
75
        *pex.rules(),
76
    )
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