• 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/subsystem.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 dataclasses import dataclass
×
7

8
from pants.backend.python.goals import lockfile
×
9
from pants.backend.python.lint.pydocstyle.skip_field import SkipPydocstyleField
×
10
from pants.backend.python.subsystems.python_tool_base import PythonToolBase
×
11
from pants.backend.python.target_types import ConsoleScript, PythonSourceField
×
12
from pants.core.goals.resolves import ExportableTool
×
13
from pants.core.util_rules.config_files import ConfigFilesRequest
×
14
from pants.engine.rules import collect_rules
×
15
from pants.engine.target import FieldSet, Target
×
16
from pants.engine.unions import UnionRule
×
17
from pants.option.option_types import ArgsListOption, BoolOption, FileOption, SkipOption
×
18
from pants.util.docutil import bin_name
×
19
from pants.util.strutil import softwrap
×
20

21

22
@dataclass(frozen=True)
×
23
class PydocstyleFieldSet(FieldSet):
×
24
    required_fields = (PythonSourceField,)
×
25

26
    source: PythonSourceField
×
27

28
    @classmethod
×
29
    def opt_out(cls, tgt: Target) -> bool:
×
30
        return tgt.get(SkipPydocstyleField).value
×
31

32

33
class Pydocstyle(PythonToolBase):
×
34
    options_scope = "pydocstyle"
×
35
    name = "Pydocstyle"
×
36
    help_short = "A tool for checking compliance with Python docstring conventions (http://www.pydocstyle.org/en/stable/)."
×
37

38
    default_main = ConsoleScript("pydocstyle")
×
39
    default_requirements = ["pydocstyle[toml]>=6.1.1,<7.0"]
×
40

41
    register_interpreter_constraints = True
×
42

43
    default_lockfile_resource = ("pants.backend.python.lint.pydocstyle", "pydocstyle.lock")
×
44

45
    skip = SkipOption("lint")
×
46
    args = ArgsListOption(example="--select=D101,D102")
×
47
    config = FileOption(
×
48
        default=None,
49
        advanced=True,
50
        help="Path to a Pydocstyle config file (http://www.pydocstyle.org/en/stable/usage.html#configuration-files).",
51
    )
52
    config_discovery = BoolOption(
×
53
        default=True,
54
        advanced=True,
55
        help=lambda cls: softwrap(
56
            f"""
57
            If true, Pants will include any relevant config files during runs
58
            (`setup.cfg`, `tox.ini`, `.pydocstyle`, `.pydocstyle.ini`, `.pydocstylerc`, `.pydocstylerc.ini`,
59
            and `pyproject.toml`) searching for the configuration file in this particular order.
60

61
            Please note that even though `pydocstyle` keeps looking for a configuration file up the
62
            directory tree until one is found, Pants will only search for the config files in the
63
            repository root (from where you would normally run the `{bin_name()}` command).
64

65
            Use `[{cls.options_scope}].config` instead if your config is in a non-standard location.
66
            """
67
        ),
68
    )
69

70
    @property
×
71
    def config_request(self) -> ConfigFilesRequest:
×
72
        # Refer to http://www.pydocstyle.org/en/stable/usage.html#configuration-files. Pydocstyle will search
73
        # configuration files in a particular order.
74
        return ConfigFilesRequest(
×
75
            specified=self.config,
76
            specified_option_name=f"{self.options_scope}.config",
77
            discovery=self.config_discovery,
78
            check_existence=[
79
                ".pydocstyle",
80
                ".pydocstyle.ini",
81
                ".pydocstylerc",
82
                ".pydocstylerc.ini",
83
            ],
84
            check_content={
85
                "setup.cfg": b"[pydocstyle]",
86
                "tox.ini": b"[pydocstyle]",
87
                "pyproject.toml": b"[tool.pydocstyle]",
88
            },
89
        )
90

91

92
def rules():
×
93
    return (
×
94
        *collect_rules(),
95
        *lockfile.rules(),
96
        UnionRule(ExportableTool, Pydocstyle),
97
    )
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