Repository navigation
Documentation coverage on pyEDAA.Reports' language-neutral model - #39
Conversation
…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>
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| CodeStyle | 1 minor |
| Complexity | 1 minor |
🟢 Metrics 101 complexity · -1 duplication
Metric Results Complexity 101 Duplication -1
🟢 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 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 Report❌ Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Breaking Changes
report:doc-coverageanalyzes a package with pyEDAA.Reports' language-neutral documentation coverage model and its Python reader (pyEDAA.Reports.DocumentationCoverage.Python.Analyzer) instead ofdocstr_coverage. The removed classesAggregatedCoverage,PackageCoverageandDocStrCoverageofpyEDAA.Reports.DocumentationCoverage.Pythonare no longer used.pyTooling.Sphinx.DocCoveragePagesis merged intopyTooling.Sphinx.DocCoverage; importDocCoverageReportPagesfrom there.DocCoverageBase.GetReport()returns aDocumentationReport; its top-level item is the package.DocCoverageBase._results(docstr_coverage's results) is gone.CondensedSource.Parse(source, path, module)takes the module'sIteminstead of docstr_coverage's expected doc-strings and the old coverage object.Changes
#:comment or doc-string literal), and items of protected (_x) and private (__x) names: the reader'sCountedItems.Default. It isn't configurable yet. Numbers in the table and on the pages change accordingly.@overloadstub, names like__all__.ifortryof a module or class, which assigns a variable or field (e.g. inif 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.SourceFileWarning) and excludes its module. Its row - in the table, a page's summary and a package's children tables - has the coverage levelerrorand says can't be read; its page says that its source can't be read or parsed.__init__.py) has a row with zero items; its page shows only the overall counters, without doc-string field and listing.__init__.pyshows Doc-string: not counted and an empty listing.Bug Fixes
report:doc-coverageand its pages work again with pyEDAA.Reportsdev(the old classes were removed by Language-neutral documentation coverage model and a Python reader edaa-org/pyEDAA.Reports#290).Known Issues
#:comment is on a later one.DocStrCoverage; a rename is pending a decision.CountedItems) and exclude patterns aren't configurable per package yet.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 ofif/try.docstr_coverageremoved from the dependency list; the extrareportsinstalls only pyEDAA.Reports.Unit Tests
tests/unit/DocCoverage.py, adjusted to the new counts and to items built with the new model.@overload, empty__init__.py, a Latin-1 module declaring its encoding, variables and fields inif/try, unreadable module and__init__.pyrows with levelerror.Others
docstr_coverageremoved from the extrareports,tests/unit/requirements.txtanddoc/requirements.txt: neither pyTooling.Sphinx nor pyEDAA.Reports' Python reader imports it.Related Issues and Pull-Requests
dev; CI installs pyEDAA.Reports fromdev). #292 mergesDocumentationCoverage/Files.pyandItems.pyintoDocumentationCoverage/__init__.pyandPython/{__init__,Source}.pyintoPython.py: model classes are imported frompyEDAA.Reports.DocumentationCoverage, the reader frompyEDAA.Reports.DocumentationCoverage.Python.