go-cover-treemap

🎄 Go code coverage to SVG treemap

https://github.com/nikolaydubina/go-cover-treemap

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • ✓
    CITATION.cff file
    Found CITATION.cff file
  • ✓
    codemeta.json file
    Found codemeta.json file
  • ✓
    .zenodo.json file
    Found .zenodo.json file
  • â—‹
    DOI references
  • â—‹
    Academic publication links
  • â—‹
    Committers with academic emails
  • â—‹
    Institutional organization owner
  • â—‹
    JOSS paper metadata
  • â—‹
    Scientific vocabulary similarity
    Low similarity (12.1%) to scientific vocabulary

Keywords

code-coverage command-line-tool heatmap treemap

Keywords from Contributors

mesh interpretability benchmarking sequences projection interactive optim hacking network-simulation
Last synced: 6 months ago · JSON representation ·

Repository

🎄 Go code coverage to SVG treemap

Basic Info
Statistics
  • Stars: 561
  • Watchers: 4
  • Forks: 15
  • Open Issues: 5
  • Releases: 9
Topics
code-coverage command-line-tool heatmap treemap
Created about 4 years ago · Last pushed 10 months ago
Metadata Files
Readme Funding License Citation Codeowners Security

README.md

🎄 Go cover to Treemap

go-recipes OpenSSF Scorecard Hits

Useful when you have large project with lots of files and packages

$ go install github.com/nikolaydubina/go-cover-treemap@latest $ go test -coverprofile cover.out ./... $ go-cover-treemap -coverprofile cover.out > out.svg

github.com/gohugoio/hugo

example-hugo

..also available in 1080x360

example-hugo-small

..and even 1080x180

example-hugo-small

github.com/gin-gonic/gin

example-gin

github.com/go-chi/chi

example-chi

github.com/nikolaydubina/treemap

example-treemap

github.com/nikolaydubina/go-featureprocessing

example-go-featureprocessing

Disclaimer

In all examples above I run go test -coverprofile <my-file> ./.... I did not do any special setup. Some projects may require additional steps to properly run test and generate full coverprofile. What you see is "lower bound" of coverage for those projects. All profiles generated on main branch of each project in GitHub on 2021-12-07.

Contributions

Welcomed! Add pretty color palettes! Add interesting examples!

Reference

  • Official Go tool to make HTML from cover profile: https://github.com/golang/go/blob/master/src/cmd/cover/html.go#L97
  • Official Go parser of cover profile golang.org/x/tools/cover: https://github.com/golang/tools/tree/master/cover
  • Go SVG Treemap renderer with treemap: https://github.com/nikolaydubina/treemap

Appendix A: Statements vs File for Size

You can see that structure and heat changes for github.com/gohugoio/hugo. Subtrees that look bad for files no longer look as bad for statements. Lots of red boxes for files become very small and unnoticeable. This can be because they contain non-testable constructs like constants. It is more accurate to use statments, since heat is percentage of covered statements, and we compute heat by weighting sum by sizes of children. In short, you are more likely want to use statements for size.

files example-hugo-files

statements example-hugo

Appendix B: Long Roots

It is common to have root and first few children to have only one child. Each takes margin and wastes space. We can collapse these into longer name, and use that space for visualizing higher depth of boxes. This is particularly useful for narrow dimensions, which makes feasible useful narrow dimension.

1080x360 with root collapsing example-long-root-med-collapsed

1080x360 without root collapse example-long-root-med-no-collapse

1080x180 with root collapsing example-long-root-med-collapsed

1080x180 without root collapse example-long-root-med-no-collapse

Appendix C: Web UI

Web UI is maintained in dedicated repository: https://github.com/nikolaydubina/go-cover-treemap-web

This is to isolate web (WASM/JS/HTML) needed dependencies, like syscall/js from minimal CLI package.

It turns out interactive UI is very helpful. Brower can be utilized as effective input source for: - changing dimensions of window -> changing dimensions of SVG - drag and drop file - slider to increase granularity of treemap

Appendix D: Only Folders

Projects that have lots of files may benefit from not displaying files but only folders. This is also useful when you want to see impact of immediate files in folder to overall folder heat. Hierarchical properties of size (sum of sizes of children) and heat (weighted heat of children) are preserved. Immediate children .go files in folder are aggregated into single child *. If there is only one * child, then it is skipped — suggested by herlon214

files example-hugo

only folders example-hugo-files

only folders without aggregation (heat and size property not preserved) example-hugo-files

Appendix E: Accessibility

Is is important that everyone can use this tool. Such we are providing color-blind option Red-Blue alternative. — suggested by Br3nda

normal example-hugo

color-blind example-hugo-color-blind

Appendix F: Percentage

It is helpful to see percentage. — by artemovechkin

Docs

bash $ cat testdata/treemap.cover | ./go-cover-treemap > docs/go-cover-treemap-stdin.svg $ ./go-cover-treemap -coverprofile testdata/treemap.cover > docs/go-cover-treemap.svg $ ./go-cover-treemap -coverprofile testdata/go-featureprocessing.cover > docs/go-featureprocessing.svg $ ./go-cover-treemap -coverprofile testdata/gin.cover > docs/gin.svg $ ./go-cover-treemap -coverprofile testdata/chi.cover > docs/chi.svg $ ./go-cover-treemap -coverprofile testdata/hugo.cover > docs/hugo.svg $ ./go-cover-treemap -coverprofile testdata/hugo.cover -w 1080 -h 360 > docs/hugo-1080x360.svg $ ./go-cover-treemap -coverprofile testdata/hugo.cover -w 1080 -h 180 > docs/hugo-1080x180.svg $ ./go-cover-treemap -coverprofile testdata/hugo.cover -statements=false > docs/hugo-files.svg $ ./go-cover-treemap -coverprofile testdata/hugo.cover -collapse-root=false > docs/hugo-long-root.svg $ ./go-cover-treemap -coverprofile testdata/hugo.cover -collapse-root=false -w 1080 -h 360 > docs/hugo-long-root-1080x360.svg $ ./go-cover-treemap -coverprofile testdata/hugo.cover -collapse-root=false -w 1080 -h 180 > docs/hugo-long-root-1080x180.svg $ ./go-cover-treemap -coverprofile testdata/hugo.cover -only-folders > docs/hugo-only-folders.svg $ ./go-cover-treemap -coverprofile testdata/hugo.cover --color-blind > docs/hugo-color-blind.svg

Owner

  • Name: Nikolay Dubina
  • Login: nikolaydubina
  • Kind: user

Citation (CITATION.cff)

cff-version: 1.2.0
message: If you reference this tool in publication, please cite it as below.
title: Go Cover Treemap
abstract: Visualization of Go code coverage via treemaps with heat
authors:
- family-names: Dubina
  given-names: Nikolay
version: 2.1
date-released: 2021-12-21
license: MIT
repository-code: https://github.com/nikolaydubina/go-cover-treemap
url: http://go-cover-treemap.io

GitHub Events

Total
  • Create event: 19
  • Release event: 1
  • Issues event: 2
  • Watch event: 72
  • Delete event: 15
  • Issue comment event: 8
  • Push event: 14
  • Pull request review comment event: 14
  • Pull request review event: 30
  • Pull request event: 36
  • Fork event: 2
Last Year
  • Create event: 19
  • Release event: 1
  • Issues event: 2
  • Watch event: 72
  • Delete event: 15
  • Issue comment event: 8
  • Push event: 14
  • Pull request review comment event: 14
  • Pull request review event: 30
  • Pull request event: 36
  • Fork event: 2

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 106
  • Total Committers: 11
  • Avg Commits per committer: 9.636
  • Development Distribution Score (DDS): 0.509
Past Year
  • Commits: 37
  • Committers: 3
  • Avg Commits per committer: 12.333
  • Development Distribution Score (DDS): 0.324
Top Committers
Name Email Commits
dependabot[bot] 4****] 52
Nikolay Dubina n****b@g****m 43
Herlon Aguiar me@h****v 3
danielstokes d****s@g****m 1
Will Beason (he/him) w****n@g****m 1
Shunya Ueta h****a 1
Pulkit Kathuria k****0@g****m 1
Juan Calderon-Perez 8****y 1
Brenda Wallace b****a@w****z 1
Artem Ovechkin 1****n 1
Artyom Nesterenko a****9@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 8
  • Total pull requests: 95
  • Average time to close issues: 16 days
  • Average time to close pull requests: 6 days
  • Total issue authors: 7
  • Total pull request authors: 11
  • Average comments per issue: 1.25
  • Average comments per pull request: 0.36
  • Merged pull requests: 67
  • Bot issues: 0
  • Bot pull requests: 84
Past Year
  • Issues: 1
  • Pull requests: 39
  • Average time to close issues: about 18 hours
  • Average time to close pull requests: 10 days
  • Issue authors: 1
  • Pull request authors: 2
  • Average comments per issue: 1.0
  • Average comments per pull request: 0.26
  • Merged pull requests: 21
  • Bot issues: 0
  • Bot pull requests: 38
Top Authors
Issue Authors
  • herlon214 (2)
  • dependabot[bot] (2)
  • nikolaydubina (1)
  • artemovechkin (1)
  • Br3nda (1)
  • jayvdb (1)
  • MarcelXia (1)
Pull Request Authors
  • dependabot[bot] (118)
  • nikolaydubina (4)
  • kevincobain2000 (2)
  • artemovechkin (2)
  • Br3nda (2)
  • hurutoriya (1)
  • danielstokes (1)
  • willbeason (1)
  • herlon214 (1)
  • gaby (1)
  • plush-mesh (1)
Top Labels
Issue Labels
documentation (2) enhancement (2) dependencies (2) bug (1) good first issue (1) go (1) github_actions (1)
Pull Request Labels
dependencies (118) github_actions (74) go (44) documentation (1)

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 2
  • Total dependent repositories: 1
  • Total versions: 9
proxy.golang.org: github.com/nikolaydubina/go-cover-treemap
  • Versions: 9
  • Dependent Packages: 2
  • Dependent Repositories: 1
Rankings
Stargazers count: 3.9%
Dependent packages count: 4.2%
Dependent repos count: 4.7%
Average: 5.2%
Forks count: 7.8%
Last synced: 6 months ago

Dependencies

go.mod go
  • github.com/lucasb-eyer/go-colorful v1.2.0
  • github.com/nikolaydubina/treemap v1.2.0
  • golang.org/x/tools v0.1.10
go.sum go
  • github.com/lucasb-eyer/go-colorful v1.2.0
  • github.com/nikolaydubina/treemap v1.2.0
  • github.com/yuin/goldmark v1.4.1
  • golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2
  • golang.org/x/crypto v0.0.0-20210921155107-089bfa567519
  • golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3
  • golang.org/x/net v0.0.0-20190620200207-3b0461eec859
  • golang.org/x/net v0.0.0-20210226172049-e18ecbb05110
  • golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f
  • golang.org/x/sync v0.0.0-20190423024810-112230192c58
  • golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
  • golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
  • golang.org/x/sys v0.0.0-20201119102817-f84b799fce68
  • golang.org/x/sys v0.0.0-20210423082822-04245dca01da
  • golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1
  • golang.org/x/sys v0.0.0-20211019181941-9d821ace8654
  • golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1
  • golang.org/x/text v0.3.0
  • golang.org/x/text v0.3.3
  • golang.org/x/text v0.3.6
  • golang.org/x/text v0.3.7
  • golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e
  • golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e
  • golang.org/x/tools v0.1.10
  • golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7
  • golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898
  • golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1