Repository navigation
Write a collapsible Gantt chart as SVG - #405
Conversation
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| UnusedCode | 1 medium |
| BestPractice | 3 medium |
| Documentation | 1 minor |
| ErrorProne | 1 high |
| Security | 2 medium |
| CodeStyle | 7 minor |
| Complexity | 2 medium |
🟢 Metrics 51 complexity · 0 duplication
Metric Results Complexity 51 Duplication 0
🟢 Coverage 100.00% diff coverage · +0.04% coverage variation
Metric Results Coverage variation ✅ +0.04% coverage variation Diff coverage ✅ 100.00% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (1d19f95) 15548 13480 86.70% Head commit (c518df2) 15588 (+40) 13521 (+41) 86.74% (+0.04%) 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 (#405) 43 43 100.00% 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✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #405 +/- ##
==========================================
+ Coverage 83.84% 83.89% +0.04%
==========================================
Files 70 70
Lines 15548 15588 +40
Branches 2345 2349 +4
==========================================
+ Hits 13036 13077 +41
+ Misses 2068 2067 -1
Partials 444 444
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
0587ea5 to
4edfec0
Compare
6d8d7d7 to
52b108d
Compare
4edfec0 to
7408a89
Compare
52b108d to
51f9842
Compare
7408a89 to
4460c10
Compare
51f9842 to
024a917
Compare
4460c10 to
21a57b4
Compare
024a917 to
af5698a
Compare
21a57b4 to
e7f5a12
Compare
af5698a to
40fff2d
Compare
e7f5a12 to
89a53b8
Compare
4a7bbe7 to
b3168a2
Compare
7fa128e to
a5abdf8
Compare
f48c306 to
e5560d1
Compare
c1bda3d to
4c784cc
Compare
e5560d1 to
149adf5
Compare
7487e62 to
8cfbbab
Compare
9e4cc05 to
29308a0
Compare
a1ae378 to
559317b
Compare
8cfbbab to
26060a3
Compare
bfe804a to
76a693a
Compare
'MatplotlibRenderer(layout, collapsible=True)' embeds a script, the rows' parents and the distance between two rows:
a click on a called workflow or a job hides or shows the rows below it. Jobs start collapsed ('collapsedKinds').
Every row's label gets an id. Writing a collapsible PNG or PDF file raises a ValueError before anything is drawn.
Ported onto the renderer class of #404: the options are the renderer's, the script is added in '_Write'.
Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
* 'CollapsibleGantt.js' and 'CollapsibleGantt.css' in the new resource package 'pyTooling.Resources.Tracing' replace the strings '_COLLAPSE_SCRIPT' and '_COLLAPSE_STYLE'. The renderer reads their content with 'readResourceFile' and embeds it, so the SVG file stays self-contained; 'getResourceFile' returns their paths. The placeholder is '/*DATA*/null', so the script is valid JavaScript on its own. 'setup.py' ships '*.js' and '*.css' of the package. * '_CollapsibleSVG' documents 'svg' as the content of the SVG file, not the file. * The collapsible SVG test checks that the placeholder is replaced and the stylesheet embedded. Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
…'__all__' in code order * 'CollapsibleGantt.css' and 'CollapsibleGantt.js' start with a one-line copyright and a one-line SPDX license. * The resource package's doc-string drops the sentence on why the files live in 'pyTooling.Resources'. * '__all__' lists the constants in the order the module defines them. Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
Note
Ported onto
dev. #404 merged as a renderer class (GanttLayout+Renderer+MatplotlibRenderer), so this pull-request no longer extends the functionWriteGantt: the options areMatplotlibRenderer's, and the script is added in its_Write. The branch now holds this one commit on top ofdev; behaviour, script and testcases are those of the first version.A pipeline chart with steps has far too many rows to read - GHDL's
masterpipeline has 1575 rows when only skipped steps are hidden - and one without steps hides where a job spent its time. This pull-request makes a Gantt chart written as SVG collapsible: a click on a called workflow or a job hides or shows the rows below it, so the chart opens compact and a job's steps are one click away.New Features
pyTooling.Tracing.Render.Matplotlib.MatplotlibRendererMatplotlibRenderer(layout, collapsible=True)adds a script to an SVG file. A click on the label, bar or line of a row with sub-rows hides every row below it and moves the following rows up; a second click shows them again. A marker in front of the label shows the state, ▸ collapsed or ▾ expanded.collapsedKinds- default: jobs - names the CI span kinds whose rows start collapsed. WithciSpanFilter(excludeSteps=StepExclusion.Skipped)the chart opens with the jobs' steps hidden, and a click on a job expands them.CollapsibleandCollapsedKinds.Writeof a collapsible renderer to a PNG or PDF file raises aValueError, before anything is drawn.CollapsibleGantt.jsandCollapsibleGantt.cssin the newresource package
pyTooling.Resources.Tracing. Their content is embedded, so the SVG file stays self-contained;getResourceFilereturns their paths.setup.pyships them.Rendergives every row's label the identifierlabel-<SpanID>, next to the bars'span-<SpanID>. A collapsible chart draws no tick marks on the y axis, which would stay behind when rows move.Documentation
doc/Tracing.rstgains a section Collapsible SVG: how to write one, which rows start collapsed, and where the script runs - in a browser, or embedded by<object>or inline; an SVG shown as an image (<img>, Markdown, a job summary) stays static.doc/News.rstlists the collapsible SVG.Unit Tests
tests/unit/Tracing/Render.py:CollapsibleandCollapsedKindsreturn what was passed;ValueError.The script itself was tested with Node.js against a minimal DOM built from the identifiers of ghdl/ghdl run 34887302325, rendered with
StepExclusion.Skipped- 1575 rows, 116 collapsible jobs with 1366 steps, 209 markers:Known Issues
Related Issues and Pull-Requests