refactor(enrichment): extract class/module checks to _class_module.py - #381
Merged
Merged
Conversation
Extract 6 check functions, 11 helpers, and 5 constants (missing-attributes, missing-typed-attributes, missing-examples, missing-cross-references, prefer-fenced-code-blocks) into enrichment/_class_module.py. Deferred import block re-exports 14 symbols for test and orchestrator access. - Reduce enrichment/__init__.py from 2,259 to 1,450 lines (36% reduction) - New _class_module.py at 857 lines with class/module enrichment checks - Update module docstring to reflect sub-package structure - Zero external API changes, zero test modifications Closes #368
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR continues the enrichment refactor by extracting the class/module-focused enrichment rules out of checks/enrichment/__init__.py into a dedicated submodule, reducing the size and responsibility of the package initializer while preserving the existing external import surface via re-exports.
Changes:
- Added
src/docvet/checks/enrichment/_class_module.pycontaining the class/module checks, helpers, and related constants. - Removed the extracted block from
src/docvet/checks/enrichment/__init__.pyand added a deferred import re-export block for compatibility. - Updated the
__init__.pymodule docstring to describe the new submodule organization.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/docvet/checks/enrichment/_class_module.py |
New extracted module for class/module enrichment checks and helpers. |
src/docvet/checks/enrichment/__init__.py |
Removes extracted implementations; adds deferred imports/re-exports and updates module docstring. |
5 tasks
Alberto-Codes
added a commit
that referenced
this pull request
Mar 23, 2026
#382) `enrichment/__init__.py` was 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. - Extract param agreement checks to `_params.py` (315 lines) - Extract deprecation notice checks to `_deprecation.py` (206 lines) - Extract reverse checks (extra raises/yields/returns) to `_reverse.py` (209 lines) - Extract late rules (trivial docstring, return type, init params) to `_late_rules.py` (375 lines) - Reduce `__init__.py` from 1,435 to 466 lines (now under 500-line gate) - Submodules access `_active_style` via `import docvet.checks.enrichment as _enrichment_pkg` at runtime Test: `uv run pytest` (1,660 tests, zero modifications) Closes #369, closes #370, closes #371, closes #372
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 2,259 lines — 4.5x the 500-line module size gate. The class/module check block was the largest self-contained concern at ~824 lines. This continues the enrichment sub-package extraction series started in #377._class_module.py__init__.pyfrom 2,259 to 1,450 lines (36% reduction)Test:
uv run pytest(1,660 tests, zero modifications)Closes #368
PR Review
Checklist
uv run pytest)uv run ruff check .)uv run ty check)!in title andBREAKING CHANGE:in bodyReview Focus
_extract_section_content,_SEE_ALSO,_XREF_MD_LINK,_XREF_SPHINX) — ordering-dependent, works because all defined before deferred import line_find_init_methodcross-consumed by_check_undocumented_init_params(stays in__init__.py)Related