Golang开源:goreporter-Golang 代码静态分析工具
fogu
8年前
<p style="text-align: center;"><img src="https://simg.open-open.com/show/395debb4b8c3936cd960f703d62ab5a9.png"></p> <h2>goreporter</h2> <p>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:</p> <ul> <li>Supported linters</li> <li>Supported template</li> <li>Installing</li> <li>Credits</li> <li>Quickstart</li> <li>Example <ul> <li>Summary</li> <li>UnitTest</li> <li>SimpleCode</li> <li>DeadCode & CopyCode</li> </ul> </li> <li>Credits</li> </ul> <h2>Supported linters</h2> <ul> <li><a href="/misc/goto?guid=4959746870402116854" rel="nofollow,noindex">unittest</a> - Golang unit test status.</li> <li><a href="/misc/goto?guid=4959746870499601180" rel="nofollow,noindex">deadcode</a> - Finds unused code.</li> <li><a href="/misc/goto?guid=4959746870583005331" rel="nofollow,noindex">gocyclo</a> - Computes the cyclomatic complexity of functions.</li> <li><a href="/misc/goto?guid=4959746870662979751" rel="nofollow,noindex">varcheck</a> - Find unused global variables and constants.</li> <li><a href="/misc/goto?guid=4959746870662979751" rel="nofollow,noindex">structcheck</a> - Find unused struct fields.</li> <li><a href="/misc/goto?guid=4959746870662979751" rel="nofollow,noindex">aligncheck</a> - Warn about un-optimally aligned structures.</li> <li><a href="/misc/goto?guid=4959615896485764722" rel="nofollow,noindex">errcheck</a> - Check that error return values are used.</li> <li><a href="/misc/goto?guid=4959643554343288281" rel="nofollow,noindex">copycode(dupl)</a> - Reports potentially duplicated code.</li> <li><a href="/misc/goto?guid=4959746870821123599" rel="nofollow,noindex">gosimple</a> - Report simplifications in code.</li> <li><a href="/misc/goto?guid=4959746870910673926" rel="nofollow,noindex">staticcheck</a> - Statically detect bugs, both obvious and subtle ones.</li> <li><a href="/misc/goto?guid=4959552609145857722" rel="nofollow,noindex">godepgraph</a> - Godepgraph is a program for generating a dependency graph of Go packages.</li> <li><a href="/misc/goto?guid=4959746871024029207" rel="nofollow,noindex">misspell</a> - Correct commonly misspelled English words... quickly.</li> </ul> <h2>Supported template</h2> <ul> <li>html template file which can be loaded via -t <file> .</li> </ul> <h2>Installing</h2> <p>There are two options for installing goreporter.</p> <ul> <li> <ol> <li>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 .</li> </ol> </li> <li> <ol start="2"> <li>Install from HEAD with: go get -u github.com/wgliang/goreporter . This has the downside that changes to goreporter may break.</li> </ol> </li> </ul> <h2>Quickstart</h2> <p>Install goreporter (see above).</p> <p>Run it:</p> <pre> $ goreporter -p [projtectRelativelyPath] -d [reportPath] -e [exceptPackagesName] -r [json/html] {-t templatePathIfHtml}</pre> <h2>Example</h2> <pre> $ goreporter -p ../goreporter -d ../goreporter -t ./templates/template.html</pre> <h3>Summary</h3> <p><img src="https://simg.open-open.com/show/cde2b19a6b6d59d52717b0f16df91cc6.jpg"></p> <h3>UnitTest</h3> <p><img src="https://simg.open-open.com/show/80d647302a67f296008e5ef0be993abe.jpg"></p> <h3>SimpleCode</h3> <p><img src="https://simg.open-open.com/show/57ae50eaa6c59a179851d128ad37e69c.jpg"></p> <h3>DeadCode & CopyCode</h3> <p><img src="https://simg.open-open.com/show/cc64a2351ed50a6dc4824e4f20701991.jpg"></p> <h2>Credits</h2> <p>Templates is designed by liufeifei</p> <p>Logo is desigend by <a href="/misc/goto?guid=4959746871107117522" rel="nofollow,noindex">xuri</a></p> <p> </p> <p>项目主页:<a href="http://www.open-open.com/lib/view/home/1491530851262">http://www.open-open.com/lib/view/home/1491530851262</a></p> <p> </p>