Repository navigation
Transfer the 'report' domain from sphinx-reports into pyTooling.Sphinx - #20
Conversation
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| UnusedCode | 1 minor |
| Documentation | 33 minor |
| ErrorProne | 2 critical |
| CodeStyle | 54 minor |
| Complexity | 6 medium 4 minor |
🟢 Metrics 333 complexity · 28 duplication
Metric Results Complexity 333 Duplication 28
🟢 Coverage 82.37% diff coverage · +7.77% coverage variation
Metric Results Coverage variation ✅ +7.77% coverage variation (-1.00%) Diff coverage ✅ 82.37% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (97f6504) 1488 1025 68.88% Head commit (091453d) 2604 (+1116) 1996 (+971) 76.65% (+7.77%) 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 (#20) 1123 925 82.37% 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 #20 +/- ##
==========================================
+ Coverage 63.61% 72.59% +8.98%
==========================================
Files 10 17 +7
Lines 1311 2427 +1116
Branches 220 342 +122
==========================================
+ Hits 834 1762 +928
- Misses 466 610 +144
- Partials 11 55 +44
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
The node comes from sphinx-reports, whose report tables it holds. It joins 'NODES' with visitors for HTML (no output) and for LaTeX, in the new module 'pyTooling.Sphinx.LaTeX'. Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
…ing.Sphinx.Report' The domain keeps its name and its directives - unittest-summary, code-coverage, code-coverage-legend, module-coverage, doc-coverage and doc-coverage-legend - and is enabled as the extension 'pyTooling.Sphinx.Report', which sets up 'pyTooling.Sphinx' first. It reads the reports with pyEDAA.Reports, which the new extra 'reports' installs, so the core extension stays free of that dependency. The configuration values are renamed to the 'pyTooling_' prefix: pyTooling_CodeCoverage_Packages/_Levels, pyTooling_DocCoverage_Packages/_Levels and pyTooling_Unittest_Testsuites. The directives use pyTooling.Sphinx's BaseDirective, and the report styles become a section of pyTooling.css. sphinx-reports' dependency table is not transferred; pyTooling.Sphinx has its own. Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
The data model testcases are ported from sphinx-reports. New testcases cover the code coverage adapter, the configuration checks, the unit test summary's helpers, and builds in HTML and LaTeX; one checks that setting up 'pyTooling.Sphinx' alone doesn't import pyEDAA.Reports. Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
A page per directive group - report:unittest-summary, report:code-coverage and report:doc-coverage -, ported from sphinx-reports' documentation, with examples rendered from the test fixtures. The index, the README, the News, the installation and dependency pages and the module doc-string say how to install the extra 'reports' and enable 'pyTooling.Sphinx.Report'. The own documentation uses 'pyTooling.Sphinx.Report' and the renamed configuration values instead of sphinx_reports, which leaves doc/requirements.txt in favour of the extra's requirements. Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
The unit test summary and the documentation coverage table import pyEDAA.Reports when they read a report, and its types only for type checking. Without the extra 'reports', the directive reports a ReportsPackageMissingError naming the packages it needs, with a note how to install them; setting up the extension and checking its configuration don't need them. BaseDirective._internalError logs an exception's notes. Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
The domain 'report' is registered by the extension 'pyTooling.Sphinx' itself;
the separate extension 'pyTooling.Sphinx.Report' is gone.
* Report/{CodeCoverage,DocCoverage,Unittest,Workaround}.py, Report/Adapter
and Report/DataModel move one level up.
* ReportDomain, ReportExtensionError, ReportsPackageMissingError,
LegendStyle and INDENTATION move into pyTooling/Sphinx/__init__.py; the
call-backs become checkReportConfiguration and readReports.
* setup() imports the report modules lazily like the other directives and
registers the domain, its directives from one mapping, the configuration
values, 'pdflscape' and FixLatexTableWidths.
The extra 'reports' stays optional: nothing setup() imports needs
pyEDAA.Reports. Documentation, README, News and tests follow the new layout.
Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
… methods ExtendedType gives every class with slots '__getstate__' and '__setstate__', whose type hints sphinx_autodoc_typehints can't read, so it warned twice per such class. Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
…omain code Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
…y side Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
9d2f3fb to
091453d
Compare
New Features
pyTooling.Sphinx: the domainreportof sphinx-reports (v0.11.2), registered by the extension itself - a project enables only"pyTooling.Sphinx".report:unittest-summary,report:code-coverage,report:code-coverage-legend,report:doc-coverage,report:doc-coverage-legend, and the prototypereport:module-coverage.pyTooling.Sphinx.CodeCoverage,.DocCoverage,.Unittest,.Workaround,.Adapter.Coverageand.DataModel.CodeCoverage.ReportDomain,ReportExtensionError(derived fromSphinxExtensionError),ReportsPackageMissingError,LegendStyleand the call-backscheckReportConfiguration/readReportsare inpyTooling.Sphinx.setup()registers the domain, its directives (from one mapping), the configuration values, the LaTeX packagepdflscapeand the post-transformFixLatexTableWidths.reports:pyEDAA.Reportsanddocstr_coverage. It is optional:pyTooling.Sphinxand itssetup()don't import them. A report directive importspyEDAA.Reportswhen it reads a report, and without it reportsReportsPackageMissingError("Reading a unit test report needs 'pyEDAA.Reports', which isn't installed.") with the noteInstall it with: pip install pyTooling.Sphinx[reports].pyTooling.Sphinx.Node.Landscape: the container node the wide report tables are put in, registered inNODESwith visitors for HTML (pyTooling.Sphinx.HTML.translateLandscape, writes nothing) and LaTeX (new modulepyTooling.Sphinx.LaTeX, alandscapeenvironment).Changes
BaseDirective._internalErrorlogs the exception's notes below its message.Compared to sphinx-reports:
The domain is registered by
pyTooling.Sphinxinstead of the extensionsphinx_reports. It is stillreport, so documents keep writing.. report:code-coverage::etc.The configuration values are renamed to the
pyTooling_prefix:report_unittest_testsuitespyTooling_Unittest_Testsuitesreport_codecov_packagespyTooling_CodeCoverage_Packagesreport_codecov_levelspyTooling_CodeCoverage_Levelsreport_doccov_packagespyTooling_DocCoverage_Packagesreport_doccov_levelspyTooling_DocCoverage_Levelsreport:dependency-tableand its adapter and data model are not transferred;dependency-tableofpyTooling.Sphinxreplaces it.The directives derive from
pyTooling.Sphinx.BaseDirective; sphinx-reports' copy of it (sphinx_reports.Sphinx) is not transferred.:style:is read byBaseDirective._ParseEnumOption. An option error now readsCaught SphinxExtensionError when checking options ...instead ofCaught ReportExtensionError ....The report styles are a section of
pyTooling.css; there is no separatesphinx-reports.<hash>.css. A theme's row stripes are reset for the report tables only - sphinx-reports reset them for every table of the documentation.[REPORT] Reading ... reportsis logged as info instead of printed, sosphinx-build -qhides it.report:doc-coveragenames itselfdoc-coveragein its messages instead ofdocstr-coverage.FixLatexTableWidthsis aSphinxPostTransformfor LaTeX, instead of reading the deprecatedBuildEnvironment.app(removed in Sphinx 11).The data model and the adapter use
ExtendedType(slots=True);Coveragedeclares_coveredBranchesand_missingBranches. The code coverage data model no longer importspyEDAA.Reports.Internal helpers follow the naming convention, e.g.
renderlevel→_RenderLevel,_formatTimedelta→_FormatTimedelta,package_DictType→PackageConfiguration.Bug Fixes
report:code-coverage-legendandreport:doc-coverage-legendraisedNameError: name 'table' is not definedin stylehorizontal-table- their default style - which aborted the build. The horizontal legend renders now, with one row of levels (the code coverage legend repeated that row).levelsis neither a palette's name nor a dictionary raised aReportExtensionErrorwith an empty message. It names the field now, and a note the type given.Known Issues
Carried over from sphinx-reports unchanged:
levelsgiven as a dictionary in a package configuration is accepted but loaded as an empty palette, so rendering that report fails; only a palette's name works.report:doc-coverageandreport:doc-coverage-legendraiseKeyErrorfor a report ID that isn't configured, which aborts the build (the other directives report it on the page).report:module-coverageshows the fixed file../../sphinx_reports/__init__.py; it is a prototype.:class:, but don't put it on the table.Documentation
report:unittest-summary,report:code-coverageandreport:doc-coverage, ported from sphinx-reports, with examples rendered from the test fixtures. Index, README, News, installation and dependency pages describe the extrareports.sphinx_reports.suppress_warningsindoc/conf.pysilencessphinx_autodoc_typehints.local_function, emitted for the__getstate__/__setstate__methodsExtendedTypeadds to every class with slots.pyEDAA.Reportsisn't released for pyTooling 10 yet, so the extra and the requirements files install it from itsdevbranch, likepyToolingitself. The transferred code imports onlypyEDAA.Reports.Unittesting.JUnitandpyEDAA.Reports.DocumentationCoverage.Python, which import with pyTooling 10; the JUnit dialect modules, which useInheritDocString(merge=True), aren't imported.docstr_coverageis part of the extra:pyEDAA.Reports.DocumentationCoverage.Pythonimports it, butpyEDAA.Reportsdoesn't require it.Coverageis not: nothing imports it, the coverage report is read as JSON.Unit Tests
tests/unit/DataModel.py: packages, modules, the hierarchy and the aggregated counts (instantiation testcases ported from sphinx-reports).tests/unit/Adapter.py: reading a Coverage.py JSON report (fixturetests/data/Report/coverage.json), a missing file and an unsupported format.tests/unit/CodeCoverage.py: the configuration checks and the coverage levels.tests/unit/Unittest.py:ShowTestcases, the runtime format and the status symbols.tests/unit/Reports.py: registration of the domain, directives and configuration values; builds in HTML and LaTeX (fixturetests/data/Report/unittest.xml); a missing report; a process checking thatsetup()doesn't importpyEDAA.Reports; and a process building reports withoutpyEDAA.Reports, checking the message and the install note.tests/unit/Extension.py:Landscapeis registered with HTML and LaTeX visitors.Related Issues and Pull-Requests
reportof pyTooling/sphinx-reports v0.11.2. The consumer projects'conf.pyfiles still usesphinx_reportsand switch in follow-up pull-requests.reportstays although it holds no objects yet: a page per testsuite and testcase will register them, with a role to refer to a testcase and a testcase index.NODESand lines to the README and the landing page; whichever merges second needs a rebase.