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

pantsbuild / pants / 20328535594

18 Dec 2025 06:46AM UTC coverage: 57.969% (-22.3%) from 80.295%
20328535594

Pull #22954

github

web-flow
Merge ccc9c5409 into 407284c67
Pull Request #22954: free up disk space in runner image

39083 of 67421 relevant lines covered (57.97%)

0.91 hits per line

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

0.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
×
5

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

23

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

29

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

38

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

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

54
    input_digest = await merge_digests(
×
55
        MergeDigests((source_files.snapshot.digest, config_files.snapshot.digest))
56
    )
57
    result = await execute_process(
×
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)
×
69

70

71
def rules():
×
72
    return (
×
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