refactor(enrichment): extract params, deprecation, reverse, late rules - #382
Merged
Merged
Conversation
Batch extract 4 remaining enrichment concerns into dedicated submodules: - _params.py: parameter agreement checks (315 lines) - _deprecation.py: missing deprecation notice checks (206 lines) - _reverse.py: extra raises/yields/returns checks (209 lines) - _late_rules.py: trivial docstring, return type, init params (375 lines) Reduces enrichment/__init__.py from 1,435 to 466 lines — now under the 500-line module size gate. Submodules access _active_style via the parent package module object at runtime. Closes #369, closes #370, closes #371, closes #372
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
Refactors the enrichment check package by extracting the remaining rule groups into dedicated submodules, keeping checks/enrichment/__init__.py focused on orchestration/dispatch and under the repo’s 500-line gate.
Changes:
- Extract parameter agreement checks/helpers into
_params.py. - Extract deprecation detection/check into
_deprecation.py. - Extract reverse checks (extra Raises/Yields/Returns) into
_reverse.py. - Extract late-added rules (trivial docstring, missing return type, undocumented init params) into
_late_rules.py, and wire all into the dispatcher via__init__.py.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/docvet/checks/enrichment/__init__.py |
Removes inlined rule implementations and re-wires dispatch/imports to the new submodules while retaining parsing + orchestrator. |
src/docvet/checks/enrichment/_params.py |
New module for signature/docstring parameter agreement parsing and checks. |
src/docvet/checks/enrichment/_deprecation.py |
New module for deprecation pattern detection and the “missing deprecation notice” check. |
src/docvet/checks/enrichment/_reverse.py |
New module for reverse checks that validate docstring claims against AST behavior. |
src/docvet/checks/enrichment/_late_rules.py |
New module for trivial-docstring, missing-return-type, and undocumented-init-params rules. |
Drop module_display_name from __init__.py imports — only used by submodules which import it directly. Removes blanket noqa: F401 that was masking the unused import.
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.
enrichment/__init__.pywas 1,435 lines after the class/module extraction (#381). This batch extracts the 4 remaining concerns into dedicated submodules, bringing the orchestrator under the 500-line gate._params.py(315 lines)_deprecation.py(206 lines)_reverse.py(209 lines)_late_rules.py(375 lines)__init__.pyfrom 1,435 to 466 lines (now under 500-line gate)_active_styleviaimport docvet.checks.enrichment as _enrichment_pkgat runtimeTest:
uv run pytest(1,660 tests, zero modifications)Closes #369, closes #370, closes #371, closes #372
PR Review
Checklist
uv run pytest)uv run ruff check .)uv run ty check)!in title andBREAKING CHANGE:in bodyReview Focus
_active_styleaccess pattern: submodules useimport docvet.checks.enrichment as _enrichment_pkgthen_enrichment_pkg._active_styleat call time — no circular import since the module is fully initialized before any check function is called_reverse.pyimports_parse_raises_entriesfrom_params.py(cross-submodule dependency) and_should_skip_reverse_checkfrom parent__init__.py_late_rules.pyimports_find_init_methodfrom_class_module.pyand_parse_sectionsfrom parentRelated
__init__.pynow under 500-line gate