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

pantsbuild / pants / 22285099215

22 Feb 2026 08:52PM UTC coverage: 75.854% (-17.1%) from 92.936%
22285099215

Pull #23121

github

web-flow
Merge c7299df9c into ba8359840
Pull Request #23121: fix issue with optional fields in dependency validator

28 of 29 new or added lines in 2 files covered. (96.55%)

11174 existing lines in 400 files now uncovered.

53694 of 70786 relevant lines covered (75.85%)

1.88 hits per line

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

97.14
/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
1✔
5

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

23

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

29

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

38

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

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

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

70

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