Repository navigation
Enable ruff docstring rules (D) - #779
Merged
Merged
Conversation
anth-volk
added this pull request to stack #755
October 13, 2026 13:28
anth-volk
force-pushed
the
ruff-docstrings
branch
from
October 13, 2026 16:56
c788978 to
d06f337
Compare
2 tasks done
anth-volk
force-pushed
the
ruff-docstrings
branch
3 times, most recently
from
October 14, 2026 14:47
4e5cc2f to
d6f1b11
Compare
anth-volk
force-pushed
the
ruff-docstrings
branch
from
October 14, 2026 17:29
d6f1b11 to
18ab375
Compare
anth-volk
force-pushed
the
ruff-docstrings
branch
4 times, most recently
from
October 14, 2026 21:06
b7ba1be to
a0166f6
Compare
anth-volk
force-pushed
the
ruff-docstrings
branch
2 times, most recently
from
October 14, 2026 21:52
740614d to
05d4fb2
Compare
anth-volk
force-pushed
the
ruff-docstrings
branch
2 times, most recently
from
October 15, 2026 15:09
a6e5037 to
fc82737
Compare
anth-volk
force-pushed
the
ruff-docstrings
branch
from
October 15, 2026 16:06
fc82737 to
f43e229
Compare
anth-volk
force-pushed
the
ruff-docstrings
branch
2 times, most recently
from
October 16, 2026 04:41
53d65e1 to
cecbd05
Compare
Validators, state helpers and URI functions get docstrings. Every Pydantic model and enum whose class docstring would become a JSON-schema description carries a D101 noqa instead, so the published contract schemas and the OpenAPI documents built from them stay byte-identical. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The ping and health models and the /ping/alive route are mounted in the executor app, so they keep their existing (OpenAPI-visible) docstrings under noqa. The no-op observability methods keep their explicit return None under RET501 noqa, and two stray string statements in the GCP module become the docstrings they were meant to be. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The entry routes are nested in create_app, so their docstrings (the OpenAPI descriptions) are untouched and the generated spec is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The /ping router endpoint keeps its OpenAPI description under a D205 noqa; the golden OpenAPI test still passes. Two placeholder pass statements in the test fixtures' mock exception classes go now that the classes have docstrings (PIE790). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Covers the executor package, the Modal apps, fixtures, scripts and test docstrings. Docstrings are added to several Modal functions; images copy src/modal into a layer, so this changes those layers like any source edit. Protocol stubs keep their ... bodies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ruff D Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The schema-authority proof reads the fixtures as text; the new docstrings avoid DDL phrases, so the bad fixture is still rejected and the good one accepted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Select pydocstyle (D) and ignore D203 and D213, the incompatible halves of the D203/D211 and D212/D213 pairs. Tests stay exempt from D1 only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With a docstring as the body, the bare return None lines are redundant; remove them instead of suppressing RET501. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the 61 D101 suppressions on contract, ping and health models with class docstrings written for API consumers, and fix the /ping/alive and gateway /ping route docstrings instead of suppressing D205. Pydantic and FastAPI copy these into schema and operation descriptions, so the entry, gateway and executor OpenAPI documents gain descriptions; paths, operations, properties, types and required lists are unchanged. The gateway golden spec is regenerated with generate_openapi. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both repos documented scripts/rules independently for ruff D, so the copies drifted apart. Take the Public API's wording so the tool stays byte-identical in both repos; only docstrings differ. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sim.quality.ruff-lint now lists D, and the rendered rules page and AGENTS.md Rules block are regenerated for the new tool hash. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#767 landed on main after this stack branched. D401, which this PR enables, wants each docstring's summary line in the imperative mood. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#743 and #744 landed on main after this stack branched. D, which this PR enables, flags their new code: blank lines after docstrings (D202), a two-line summary (D205, D209), summaries that are not in the imperative mood (D401), an escaped backslash in the sentinel's module docstring (D301), and three public functions without docstrings (D103). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#789 landed on main after this stack branched. D, which this PR enables, flags blank lines after its new docstrings (D202) and the undocumented __call__ of its ConnectionOpener protocol (D102). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#787 landed on main after this stack branched. D, which this PR enables, flags the undocumented __init__ (D107), upload_bytes and read_bytes (D102) of the in-memory object store it moved into the executor's fixtures. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
D, which this PR enables, flags the undocumented group_label property (D102), the budget check's run-on summary (D205, D209) and two test helpers' summaries that are not in the imperative mood (D401). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#791 landed on main after this stack branched. D, which this PR enables, flags blank lines after five of its new docstrings (D202) and the undocumented __init__ (D107) and stage method (D102) of its StageProgress tracker. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#758 landed on main after this stack branched. D, which this PR enables, flags its permission checks and deployed permission test: - CallerAuthorizer's initializer and authorize now say what enforcement does with a caller that lacks a permission, and that the missing permission is always recorded; - the permission_enforcement fixture says when it skips and when it raises, and the enforced-permission deployment test says what it checks; - the blank lines after the docstrings of is_client_credentials, granted_permissions, the gty validator and the Cloud Run deployment-environment test helper go. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#781 landed on main after this stack branched. D, which this PR enables, flags its job progress code: - the JobProgressReporter protocol and each of its methods say which stage boundary the runtime reports; the null reporter's methods say what they discard, with the docstring as the body; - StoredJobProgressReporter's initializer, record, start, set_execution, enter, start_segments, segment_completed and attempts say how the record changes, including when a call changes nothing; - the contract's job progress store functions say what they read and write, and StageReportingSimulation and its ensure say when the callback runs; - the floor and maximum helpers, the Modal reporter factory, the published-record helper and the gateway's stage-field helper are in the imperative mood, and blank lines after docstrings go. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anth-volk
force-pushed
the
ruff-docstrings
branch
from
October 16, 2026 04:54
cecbd05 to
ea919cb
Compare
anth-volk
marked this pull request as ready for review
October 16, 2026 05:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #778
Same-Repository Draft PR Check
PolicyEngine/policyengine-sim-api, not a personal fork.Summary
Phase 1 step 1.8, group 4: docstrings. Stacked on #777.
ruff.tomlgainsDand ignoresD203andD213, keepingD211(no blank line before a class docstring) andD212(summary on the first line). Every module, class and function outside tests is documented, one commit per project. The 1,043 findings at the base were: executor 427, contract 179, gateway 139, fastapi 118, entry 60, persistence 25, observability 22, integration tests 17, and 56 in repo scripts, proof fixtures and package markers.observability/emitters.py: documented no-op methods drop their redundantreturn Noneinstead of suppressing RET501.opentelemetry/gcp.py: two misplaced string literals (a class description after__init__, and a function description after its imports) are replaced by docstrings in the right place.D. An earlier commit suppressedD101on 61 published contract, ping and health models; the commit "Document published contract models and routes" replaces every one with a docstring.description, and FastAPI copies a route docstring into the operation description. So the entry, gateway and executor OpenAPI documents gain descriptions, written for API consumers. The gateway golden spec (tests/golden/openapi.json) is regenerated withgenerate_openapi. Compared with the base, ignoringdescriptionkeys, it's structurally identical: 25 descriptions added, none changed or removed.scripts/rulesindependently, so the copies drifted. This PR takes the Public API's wording, so the tool is byte-identical again (tool sha256db83d5ad2aa4in both rendered rules pages). Only docstrings differ from the previous copy.sim.quality.ruff-lintnow listsD.main: Count households once: sum the weight column unweighted #767 added two docstrings whose summary lines aren't in the imperative mood, which D401 requires. The commit "Put the docstrings Count households once: sum the weight column unweighted #767 added in the imperative mood" rewords those two lines.Testing
All seven projects' test suites pass:
ruff check(0.15.22) is clean repo-wide, andruff format --checkis unchanged.The rules guard, the
ci-scriptsguard and the rules tool unittest pass.🤖 Generated with Claude Code