Skip to content

Commit 9d76ee8

Browse files
committed
docs: add doc comments to ensure all schemas are captured
The `#:` syntax is a special format that tells autodoc to include the following object. This is better than using `:undoc-members:` which would otherwise include every global variable in the modules.
1 parent 216dda4 commit 9d76ee8

File tree

15 files changed

+19
-8
lines changed

15 files changed

+19
-8
lines changed

src/taskgraph/config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
logger = logging.getLogger(__name__)
2121

22+
23+
#: Schema for the graph config
2224
graph_config_schema = Schema(
2325
{
2426
# The trust-domain for this graph.
@@ -102,7 +104,6 @@
102104
Extra: object,
103105
}
104106
)
105-
"""Schema for GraphConfig"""
106107

107108

108109
@dataclass(frozen=True, eq=False)

src/taskgraph/decision.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
}
4040

4141

42+
#: Schema for try_task_config.json version 2
4243
try_task_config_schema_v2 = Schema(
4344
{
4445
Optional("parameters"): {str: object},

src/taskgraph/parameters.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ class ParameterMismatch(Exception):
2828
"""Raised when a parameters.yml has extra or missing parameters."""
2929

3030

31-
# Please keep this list sorted and in sync with docs/reference/parameters.rst
31+
#: Schema for base parameters.
32+
#: Please keep this list sorted and in sync with docs/reference/parameters.rst
3233
base_schema = Schema(
3334
{
3435
Required("base_repository"): str,

src/taskgraph/transforms/chunking.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from taskgraph.util.schema import Schema
1111
from taskgraph.util.templates import substitute
1212

13+
#: Schema for chunking transforms
1314
CHUNK_SCHEMA = Schema(
1415
{
1516
# Optional, so it can be used for a subset of tasks in a kind

src/taskgraph/transforms/docker_image.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
transforms = TransformSequence()
3232

33+
#: Schema for docker_image transforms
3334
docker_image_schema = Schema(
3435
{
3536
# Name of the docker image.

src/taskgraph/transforms/fetch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
CACHE_TYPE = "content.v1"
2525

26+
#: Schema for fetch transforms
2627
FETCH_SCHEMA = Schema(
2728
{
2829
# Name of the task.
@@ -53,7 +54,6 @@
5354
}
5455
)
5556

56-
5757
# define a collection of payload builders, depending on the worker implementation
5858
fetch_builders = {}
5959

src/taskgraph/transforms/from_deps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from taskgraph.util.schema import Schema, validate_schema
2424
from taskgraph.util.set_name import SET_NAME_MAP
2525

26+
#: Schema for from_deps transforms
2627
FROM_DEPS_SCHEMA = Schema(
2728
{
2829
Required("from-deps"): {
@@ -111,7 +112,6 @@
111112
Extra: object,
112113
},
113114
)
114-
"""Schema for from_deps transforms."""
115115

116116
transforms = TransformSequence()
117117
transforms.add_validate(FROM_DEPS_SCHEMA)

src/taskgraph/transforms/matrix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from taskgraph.util.schema import Schema
1717
from taskgraph.util.templates import substitute_task_fields
1818

19+
#: Schema for matrix transforms
1920
MATRIX_SCHEMA = Schema(
2021
{
2122
Required("name"): str,
@@ -60,7 +61,6 @@
6061
Extra: object,
6162
},
6263
)
63-
"""Schema for matrix transforms."""
6464

6565
transforms = TransformSequence()
6666
transforms.add_validate(MATRIX_SCHEMA)

src/taskgraph/transforms/notify.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
}
5555
"""Map each type to its primary key that will be used in the route."""
5656

57+
#: Schema for notify transforms
5758
NOTIFY_SCHEMA = Schema(
5859
{
5960
Exclusive("notify", "config"): {
@@ -90,7 +91,6 @@
9091
},
9192
extra=ALLOW_EXTRA,
9293
)
93-
"""Notify schema."""
9494

9595
transforms = TransformSequence()
9696
transforms.add_validate(NOTIFY_SCHEMA)

src/taskgraph/transforms/run/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
Optional("verify-hash"): bool,
3737
}
3838

39-
# Schema for a build description
39+
#: Schema for a run transforms
4040
run_description_schema = Schema(
4141
{
4242
# The name of the task and the task's label. At least one must be specified,

0 commit comments

Comments
 (0)