golang静态代码检查_一个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 normalizes their output to a report:

Supported linters

gofmt - Checks if the code is properly formatted and could not be further simplified.

govet - Reports variables that may have been unintentionally shadowed.

golint - Golint is a linter for Go source code.

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.

countcode - Count lines and files of project.

interfacer - Suggest narrower interfaces that can be used.

depth - Count the maxdepth of go functions.

flen - Flen provides stats on functions/methods lengths in a Golang package.

Template

html template file which can be loaded via -t .

Todo List

This version will re-design the template.

Add interfacer and safesql and gofmt(-s),govet linter.

Installing

Requirements

Quickstart

Install goreporter (see above).

go get -u github.com/360EntSecGroup-Skylar/goreporter

Run it:

NOTE

You have to confirm that your project is operational. In particular, the problem with vendor, when the package is not found in the default path, goreporter will look again from the possible vendor path.

goreporter -p [projectRelativePath] -r [reportPath] -e [exceptPackagesName] -f [json/html/text] {-t templatePathIfHtml}

-version Version of GoReporter.

-p Must be a valid Golang project path.

-r Save the path to the report.

-e Exceptional packages (multiple separated by commas, for example: "linters/aligncheck,linters/cyclo" ).

-f report format json, html OR text.

-t Template path,if not specified, the default template will be used.

By default, the default template is used to generate reports in html format.

Example

you can see result detail:online-example-report

Credits

Logo is designed by Ri Xu

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值