Skip to content

Documentation coverage on pyEDAA.Reports' language-neutral model - #39

Merged
Paebbels merged 5 commits into
devfrom
claude/doccov-model
Oct 16, 2026
Merged

Paebbels merged 5 commits into
devfrom
claude/doccov-model

Conversation

@pytooling-claude

Copy link
Copy Markdown

Breaking Changes

  • report:doc-coverage analyzes a package with pyEDAA.Reports' language-neutral documentation coverage model and its Python reader (pyEDAA.Reports.DocumentationCoverage.Python.Analyzer) instead of docstr_coverage. The removed classes AggregatedCoverage, PackageCoverage and DocStrCoverage of pyEDAA.Reports.DocumentationCoverage.Python are no longer used.
  • Module pyTooling.Sphinx.DocCoveragePages is merged into pyTooling.Sphinx.DocCoverage; import DocCoverageReportPages from there.
  • DocCoverageBase.GetReport() returns a DocumentationReport; its top-level item is the package. DocCoverageBase._results (docstr_coverage's results) is gone.
  • CondensedSource.Parse(source, path, module) takes the module's Item instead of docstr_coverage's expected doc-strings and the old coverage object.

Changes

  • The counters include a class' fields and a module's variables, as Sphinx' autodoc documents them (#: comment or doc-string literal), and items of protected (_x) and private (__x) names: the reader's CountedItems.Default. It isn't configurable yet. Numbers in the table and on the pages change accordingly.
  • Ignored, i.e. not expected to be documented: a property's setter, an @overload stub, names like __all__.
  • The condensed listing marks a field's or variable's lines by the state of its item; a class' or function's lines by its item starting at the first line (decorator included).
  • An if or try of a module or class, which assigns a variable or field (e.g. in if TYPE_CHECKING:), is shown with the headers of its clauses, its blocks like a body; the assignments are marked. A statement holding definitions is shown the same way.
  • A source file, which can't be read or parsed, no longer fails the whole package: the analysis logs it once as a warning (SourceFileWarning) and excludes its module. Its row - in the table, a page's summary and a package's children tables - has the coverage level error and says can't be read; its page says that its source can't be read or parsed.
  • A namespace package (directory without __init__.py) has a row with zero items; its page shows only the overall counters, without doc-string field and listing.
  • An empty __init__.py shows Doc-string: not counted and an empty listing.
  • A page's listing reads the source in its declared encoding.
  • The analysis duration per package is logged at verbose level.

Bug Fixes

Known Issues

  • A repeated assignment of a variable is marked on its first line only, also when its #: comment is on a later one.
  • The directive class is still named DocStrCoverage; a rename is pending a decision.
  • The counted items (CountedItems) and exclude patterns aren't configurable per package yet.
  • A file, which couldn't be read or parsed, is recognized by its item being excluded without a documentation state; pyEDAA.Reports has no explicit marker for it.

Documentation

  • report:doc-coverage: new section Analysis (what is counted, documented, ignored, excluded; the counting policy; unreadable files); the listing's rules and state table describe the model's items and the clauses of if/try.
  • docstr_coverage removed from the dependency list; the extra reports installs only pyEDAA.Reports.
  • News entry.

Unit Tests

  • Tests of the pages, the listing, the condensing and the role moved to tests/unit/DocCoverage.py, adjusted to the new counts and to items built with the new model.
  • New: namespace package, module doc-string state, repeated assignment, documentation states, an excluded item, ignored setter and @overload, empty __init__.py, a Latin-1 module declaring its encoding, variables and fields in if/try, unreadable module and __init__.py rows with level error.

Others

  • docstr_coverage removed from the extra reports, tests/unit/requirements.txt and doc/requirements.txt: neither pyTooling.Sphinx nor pyEDAA.Reports' Python reader imports it.

Related Issues and Pull-Requests

claude-code and others added 5 commits October 16, 2026 00:54
…odel.

pyEDAA.Reports #290 replaced the docstr_coverage-based classes (AggregatedCoverage, PackageCoverage, DocStrCoverage)
by a language-neutral model (DocumentationReport, Directory, File, Item with kind, category and coverage state) and a
Python reader (Analyzer). The directive 'report:doc-coverage', its pages and the role ':doccov:' failed to import.

- Analysis: Analyzer inside a WarningCollector; each SourceFileWarning (unreadable or unparsable file, module
  excluded) is logged as a Sphinx warning with its cause. The analysis duration is logged at verbose level.
- Table: a package's row counts its '__init__.py' (File.Counters), a module's row its file; the summary row the
  report's counters and FileCount. A namespace package's row counts zero items.
- Pages: built from the package/module items; children by ItemKind; a package's overall row uses the item's
  aggregated counters and its directory's FileCount; the listing reads the source in its declared encoding, an
  unparsable source is stated on the page.
- CondensedSource: marks a line by the state of the item starting there (File.Items, StartLine) instead of
  docstr_coverage's expected list and the class scope lookup; fields and variables are marked now.
- Model classes are imported from pyEDAA.Reports.DocumentationCoverage only, the reader from
  pyEDAA.Reports.DocumentationCoverage.Python.
- DocCoveragePages.py is merged into DocCoverage.py, which removes the function-local imports of the import cycle;
  its tests move to tests/unit/DocCoverage.py.

Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
pyEDAA.Reports' Python reader analyzes the documentation coverage itself; neither it nor pyTooling.Sphinx imports
docstr_coverage. Removed from setup.py, tests/unit/requirements.txt, doc/requirements.txt and doc/Dependency.rst.

Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
New section 'Analysis' of report:doc-coverage: what is counted, documented, ignored and excluded, and how an
unreadable source file is reported. The listing's state table describes the model's items; a namespace package's
page; the extra 'reports' installs pyEDAA.Reports only; News entry.

Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
… files as errors.

Review fixes on top of the port; no reviewed commit is changed.

- CondensedSource: an 'if' or 'try' of a module or class, which assigns a variable or field, is taken with the
  headers of its clauses and each clause's block like a body, so the reader's items there - e.g. 'T' in
  'if TYPE_CHECKING:', 'HAS' in 'try:', a class field in an 'if' - are shown and marked. A statement holding
  definitions is taken the same way. parse() names the module's path.
- A package's '__init__.py' or a module, which the analysis couldn't read or parse, has the coverage level 'error'
  and the text "can't be read" in the table, in a page's summary and in a package's children tables; its page says
  so without reading the file again, so it is warned about once (by the analysis).
- subPackagesAndModules(), fileCounters(), isUnreadable() and coverageCell() are module-level functions instead of
  helpers on DocCoverageBase, which the legend doesn't use.
- Module doc-string: one paragraph about the key 'pages'.
- Tests: documentation states, an excluded item, ignored setter and '@overload', an empty '__init__.py', a Latin-1
  module declaring its encoding, assignments in 'if'/'try', the multi-line variable of 'Length', unreadable rows.

Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
…eadable rows.

The section 'Analysis' states that fields, variables, protected and private names are counted
(CountedItems.Default), not configurable yet, and links the Python reader's section (#doccov-python). The listing
rules describe the clauses of 'if' and 'try'; an unreadable file's row has the level 'error'.

Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
@pytooling-claude
pytooling-claude Bot requested a review from Paebbels as a code owner October 16, 2026 00:55
@pytooling-claude pytooling-claude Bot added the Enhancement New feature or request label Oct 16, 2026
@codacy-production

codacy-production Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 2 minor

Alerts:
⚠ 2 issues (≤ 0 issues of at least minor severity)

Results:
2 new issues

Category Results
CodeStyle 1 minor
Complexity 1 minor

View in Codacy

🟢 Metrics 101 complexity · -1 duplication

Metric Results
Complexity 101
Duplication -1

View in Codacy

🟢 Coverage 94.94% diff coverage · +5.78% coverage variation

Metric Results
Coverage variation ✅ +5.78% coverage variation (-1.00%)
Diff coverage ✅ 94.94% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (ae4e5d7) 4219 3366 79.78%
Head commit (360c20a) 4224 (+5) 3614 (+248) 85.56% (+5.78%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#39) 237 225 94.94%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@codecov

codecov Bot commented Oct 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.24895% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.40%. Comparing base (ae4e5d7) to head (360c20a).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
pyTooling/Sphinx/DocCoverage.py 93.19% 11 Missing and 2 partials ⚠️
pyTooling/Sphinx/CondensedSource.py 93.02% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev      #39      +/-   ##
==========================================
+ Coverage   77.76%   83.40%   +5.63%     
==========================================
  Files          23       22       -1     
  Lines        4219     4224       +5     
  Branches      642      643       +1     
==========================================
+ Hits         3281     3523     +242     
+ Misses        853      610     -243     
- Partials       85       91       +6     
Flag Coverage Δ
unittests 83.40% <93.24%> (+5.63%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@Paebbels
Paebbels merged commit 18682d1 into dev Oct 16, 2026
52 of 53 checks passed
@Paebbels
Paebbels deleted the claude/doccov-model branch October 16, 2026 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants