Giter VIP home page Giter VIP logo

gocov-html's People

Contributors

matm avatar mschoch avatar popbones avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gocov-html's Issues

panic by test packages without test files

my-package has no testfiles
gocov test github.com/my-package | gocov-html

panic: runtime error: index out of range
goroutine 1 [running]:
github.com/matm/gocov-html/cov.printReport(0x44d218, 0xc82002c010, 0xc82003be00)
github.com/matm/gocov-html/cov/report.go:163 +0xa0c
github.com/matm/gocov-html/cov.HTMLReportCoverage(0x44d2e8, 0xc82002c008, 0x0, 0x0, 0x0, 0x0)
github.com/matm/gocov-html/cov/report.go:276 +0x49f
main.main()
gopkg.in/matm/v1/gocov-html/gocov-html.go:50 +0xfb

The same with the XML reporter works:
gocov test github.com/my-package | gocov-xml

Latest version 1.1.1 breaks go install

Latest version tag seems to be broken:

$ go install github.com/matm/gocov-html@latest
go: github.com/matm/gocov-html@latest: module github.com/matm/gocov-html@latest found (v1.1.1), but does not contain package github.com/matm/gocov-html

I'm using go 1.18.1 on ubuntu18

Error: ... /[email protected]/pkg/themes/theme.go:9:2: cannot use defaultTheme{

Hi @matm, is it possible that your latest commits introduced a regression issue.
When I want to install your package
go install github.com/matm/gocov-html/cmd/gocov-html@latest
I am getting following error:

github.com/matm/gocov-html/pkg/themes

../gopath/pkg/mod/github.com/matm/[email protected]/pkg/themes/theme.go:9:2: cannot use defaultTheme{} (value of type defaultTheme) as types.Beautifier value in array or slice literal: defaultTheme does not implement types.Beautifier (missing method Data)

../gopath/pkg/mod/github.com/matm/[email protected]/pkg/themes/theme.go:10:2: cannot use kitTheme{} (value of type kitTheme) as types.Beautifier value in array or slice literal: kitTheme does not implement types.Beautifier (missing method Data)

../gopath/pkg/mod/github.com/matm/[email protected]/pkg/themes/theme.go:14:33: cannot use defaultTheme{} (value of type defaultTheme) as types.Beautifier value in variable declaration: defaultTheme does not implement types.Beautifier (missing method Data)

Shall I use earlier version?

Best regards
Eckard.

Add CLI support for coverage thresholds

Rationale

Would allow to only add functions/methods whose code coverage is lower or greater than threshold values.

For example, the strings package in the standard library have only 12 functions/methods with a code coverage < 100%.
Using a CLI flag -cmax 97 would add those 12 functions only into the generated HTML output.

Setting a threshold value can be useful to quickly find what is left for testing and generate the HTML output faster.

Example

$ gocov test strings | gocov-html -cmax 97
  • Add a -cmax flag (default: 100) stating "only show functions whose coverage is less than cmax"
  • Add a -cmin flag (default: 0) stating "only show functions whose coverage is more than cmin"
  • Only take into account functions/methods whose code coverage is lower than the max value. Same regarding min value.
  • Update README documentation

New `volt` theme

  • New volt theme based on the volt boostrap theme
  • Use very few components from this theme and make sure everything is included in the single HTML output
  • Add a screenshot in the README

Last release breaks `go install`

Running go install github.com/matm/gocov-html@latest fails with the following error:

go install github.com/matm/gocov-html@latest: module github.com/matm/gocov-html@latest found (v1.1.1), but does not contain package github.com/matm/gocov-html

Installing with go install github.com/matm/gocov-html@71874e2e203b87a703f46020febb9650f0f8320d works fine

Broken semver tag v1.2

Hi @matm
Tag v1.2 is broken - it should be v1.2.0

GO supports only semver tags or commit hashes for public modules.
https://go.dev/blog/publishing-go-modules

When I'm trying to install the latest version go fetches only v1.1.1

go install github.com/matm/gocov-html/cmd/gocov-html@latest

go: downloading github.com/matm/gocov-html v1.1.1
go: downloading github.com/axw/gocov v1.1.0

When I try to install v1.2 go throws an error

go install github.com/matm/gocov-html/cmd/[email protected]

go: github.com/matm/gocov-html/cmd/[email protected]: no matching versions for query "v1.2"

"<<" problem

Output is very nice, but my code uses "<<" operator.

Instead of seeing:

            flags & (1<<uint(i))

I only see:

           flags & (1<

I think you didn't change the whole "<" to "<" (lol, github change html code :) => "& lt ;")

Regards

refac: generate Go code to render themes

Generating the code for methods Beautifier.Template() and Beautifier.Data() will ease theme management. This way Beautifer.Assets() can be used to simply define the required assets to build a theme.

  • Remove implementions of Beautifier.Template() and Beautifier.Data() for the golang (default) theme
  • Write a Go generator in pkg/themes/generator.go that will generate a default_gen.go file implementing those two methods with proper content taken from Assets()
  • Update the build system to go generate before building

go get issues on gopkg.in/matm/v1/gocov-html

remote: Cannot obtain refs from GitHub: cannot talk to GitHub: Get https://github.com/matm/gocov-html.git/info/refs?service=git-upload-pack: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
fatal: unable to access 'https://gopkg.in/matm/v1/gocov-html/': The requested URL returned error: 502
package gopkg.in/matm/v1/gocov-html: exit status 1

Formatting of code in the report

Hi,

like this tool! Ad title: The source code in the report has sometimes malformed indentation (off by one level in both ways: 1 too much or 1 too les). It's only cosmetic, the tool is usable anyway. Thanks for publishing it.

Add support for themes

The default HTML doc and its style can be vastly improved. Let's add support for themes and use the default CSS in the default theme.

  • Convert CSS into a default theme
  • Use a simple theming framework
  • Add a -lt flag to list available themes
  • Add a -t flag to render a specific theme
  • Update README.md
  • Update ChangeLog

Is gocov only supposed to work on code within GOPATH?

Apologies for a newbie question (i'm fairly new to Go)
Let's say i have code living in
~/dev/project/go_implementation/api. This is not inside my GOPATH which is set to be ~/dev/go.
I can run go test and it passes fine.
However, when i run the gocov test tool, i get an error saying that
coverage: 40.9% of statements ok _/Users/toli/dev/project/go_implementation/api 0.009s error: can't find "main.go": cannot find package "_/Users/toli/dev/project/go_implementation/api" in any of: /usr/local/Cellar/go/1.4.2/libexec/src/_/Users/toli/dev/project/go_implementation/api (from $GOROOT) /Users/toli/dev/go/src/_/Users/toli/dev/project/go_implementation/api (from $GOPATH)

If i symlink the directory to be inside GOPATH and cd into it, things work:
~/dev/go/src/github.com/toli/project/go_implementation/api

So, the potential newbie question: can gocov only run from inside the GOPATH?
That works fine for me on my laptop, but I can't get it to work with CircleCI so i'm hoping there's an easier workaround.

go get fails

➜  go git:(master) ✗ go get -u gopkg.in/matm/v1/gocov-html/cmd/gocov-html
# github.com/matm/gocov-html/pkg/cov
XXX/.gvm/pkgsets/go1.11/global/src/github.com/matm/gocov-html/pkg/cov/report.go:161:17: undefined: io.ReadAll

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.