golang静态代码检查_goreporter:Golang 代码静态分析工具

goreporter

A Golang tool that does static analysis, unit testing, code review and generate code quality report. This is a tool that concurrently runs a whole bunch of those linters and normalises their output to a report:

Supported linters

Supported template

Installing

Credits

Quickstart

Example

Summary

UnitTest

SimpleCode

DeadCode & CopyCode

Credits

Supported linters

unittest - Golang unit test status.

deadcode - Finds unused code.

gocyclo - Computes the cyclomatic complexity of functions.

varcheck - Find unused global variables and constants.

structcheck - Find unused struct fields.

aligncheck - Warn about un-optimally aligned structures.

errcheck - Check that error return values are used.

copycode(dupl) - Reports potentially duplicated code.

gosimple - Report simplifications in code.

staticcheck - Statically detect bugs, both obvious and subtle ones.

godepgraph - Godepgraph is a program for generating a dependency graph of Go packages.

misspell - Correct commonly misspelled English words... quickly.

Supported template

html template file which can be loaded via -t .

Installing

There are two options for installing goreporter.

Install a stable version, eg. go get -u github.com/wgliang/goreporter/tree/version-1.0.0 . I will generally only tag a new stable version when it has passed the Travis regression tests. The downside is that the binary will be called goreporter.version-1.0.0 .

Install from HEAD with: go get -u github.com/wgliang/goreporter . This has the downside that changes to goreporter may break.

Quickstart

Install goreporter (see above).

Run it:

$ goreporter -p [projtectRelativelyPath] -d [reportPath] -e [exceptPackagesName] -r [json/html] {-t templatePathIfHtml}

Example

$ goreporter -p ../goreporter -d ../goreporter -t ./templates/template.html

Summary

UnitTest

SimpleCode

DeadCode & CopyCode

Credits

Templates is designed by liufeifei

Logo is desigend by xuri

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值