Skip to content

Latest commit

 

History

History
66 lines (56 loc) · 3.83 KB

README.md

File metadata and controls

66 lines (56 loc) · 3.83 KB

commentcov-plugin-go

commentcov-plugin-go is the commentcov plugin for go

How to use

Specify plugin info on your commentcov configuraiton (default is <path_to_project>/.commentcov.yaml).

$ pwd
/home/commentcov/workspace/github.com/kubernetes/kubernetes

$ cat .commentcov.yaml
plugins:
  - extension: .go
    install_command: go install github.com/commentcov/commentcov-plugin-go@latest
    execute_command: commentcov-plugin-go
exclude_paths:
  - "vendor/**/**"
  - "**/**_test.go"
mode: scope

Then, run commentcov. You could get the comment coverage of the .go files in csv format.

$ commentcov coverage
{"@level":"info","@message":"Install Plugin","@module":"commentcov","@timestamp":"2022-06-27T14:38:53.552977+09:00","plugin":"commentcov-plugin-for-go"}
{"@level":"debug","@message":"starting plugin","@module":"commentcov","@timestamp":"2022-06-27T14:38:56.009873+09:00","args":["commentcov-plugin-go"],"path":"/home/terakoya76/go/bin/commentcov-plugin-go"}
{"@level":"debug","@message":"plugin started","@module":"commentcov","@timestamp":"2022-06-27T14:38:56.010089+09:00","path":"/home/terakoya76/go/bin/commentcov-plugin-go","pid":359483}
{"@level":"debug","@message":"waiting for RPC address","@module":"commentcov","@timestamp":"2022-06-27T14:38:56.010123+09:00","path":"/home/terakoya76/go/bin/commentcov-plugin-go"}
{"@level":"debug","@message":"plugin address","@module":"commentcov.commentcov-plugin-go","@timestamp":"2022-06-27T14:38:56.013775+09:00","address":"/tmp/plugin341157163","network":"unix","timestamp":"2022-06-27T14:38:56.013+0900"}
{"@level":"debug","@message":"using plugin","@module":"commentcov","@timestamp":"2022-06-27T14:38:56.013824+09:00","version":1}
{"@level":"trace","@message":"waiting for stdio data","@module":"commentcov.stdio","@timestamp":"2022-06-27T14:38:56.014527+09:00"}
,FILE,10.67036890122967
,PRIVATE_CLASS,45.61276287164612
,PRIVATE_FUNCTION,30.317776735459663
,PRIVATE_TYPE,42.21311475409836
,PRIVATE_VARIABLE,16.287672723316287
,PUBLIC_CLASS,87.85892224990167
,PUBLIC_FUNCTION,53.6091994076139
,PUBLIC_TYPE,88.03245436105476
,PUBLIC_VARIABLE,69.56668923493568
{"@level":"debug","@message":"received EOF, stopping recv loop","@module":"commentcov.stdio","@timestamp":"2022-06-27T14:38:57.536686+09:00","err":"rpc error: code = Unavailable desc = error reading from server: EOF"}
{"@level":"info","@message":"plugin process exited","@module":"commentcov","@timestamp":"2022-06-27T14:38:57.542710+09:00","path":"/home/terakoya76/go/bin/commentcov-plugin-go","pid":359483}
{"@level":"debug","@message":"plugin exited","@module":"commentcov","@timestamp":"2022-06-27T14:38:57.542746+09:00"}

Commentcov CoverageItem Scope Mapping

The mapping from the type of Go code comment to the CoverageItem Scope is below.

Scope Name Golang Node
CoverageItem_UNKNOWN N/A
CoverageItem_FILE Package Comment
CoverageItem_PUBLIC_MODULE doc.go (Not Supported yet)
CoverageItem_PRIVATE_MODULE N/A
CoverageItem_PUBLIC_CLASS Exported Struct, Interface Comment
CoverageItem_PRIVATE_CLASS Unexported Struct, Interface Comment
CoverageItem_PUBLIC_TYPE Exported Type Alias Comment
CoverageItem_PRIVATE_TYPE Unexported Type Alias Comment
CoverageItem_PUBLIC_FUNCTION Exported Function Comment
CoverageItem_PRIVATE_FUNCTION Unexported Function Comment
CoverageItem_PUBLIC_VARIABLE Exported Var, Const Comment
CoverageItem_PRIVATE_VARIABLE Unexported Var, Const Comment