goreporter
A Golang tool that does static analysis, unit testing, code review and generate code quality report.
Top Related Projects
Fast linters runner for Go
Staticcheck - The advanced Go linter
Go security checker
🔥 ~6x faster, stricter, configurable, extensible, and beautiful drop-in replacement for golint
DEPRECATED: Use https://github.com/golangci/golangci-lint
A Golang tool that does static analysis, unit testing, code review and generate code quality report.
Quick Overview
GoReporter is an open-source tool for generating Go code quality reports. It analyzes Go projects for various metrics, including code style, unit testing, cyclomatic complexity, and dependency analysis, providing developers with insights to improve their codebase.
Pros
- Comprehensive analysis: Covers multiple aspects of code quality in a single tool
- Easy integration: Can be integrated into CI/CD pipelines for automated reporting
- Customizable: Allows users to configure which checks to run and set thresholds
- Generates visual reports: Produces HTML reports for easy interpretation of results
Cons
- Limited active development: The project hasn't seen frequent updates recently
- Performance issues: May be slow on large codebases
- False positives: Some checks might produce false positives, requiring manual review
- Limited documentation: Some features and configurations lack detailed explanations
Getting Started
To use GoReporter, follow these steps:
- Install GoReporter:
go get -u github.com/qax-os/goreporter
- Run GoReporter on your project:
goreporter -p [projectRelativePath] -r [reportPath] -e [exceptPackages] -f [reportFormat]
Example:
goreporter -p ./my-project -r ./report -f html
This will analyze the project in ./my-project
, generate an HTML report, and save it in the ./report
directory.
For more advanced usage and configuration options, refer to the project's README on GitHub.
Competitor Comparisons
Fast linters runner for Go
Pros of golangci-lint
- Faster execution due to parallel linting and caching
- Supports a wider range of linters (over 50)
- More actively maintained with frequent updates
Cons of golangci-lint
- Steeper learning curve due to more complex configuration
- May produce more false positives due to the large number of linters
Code comparison
goreporter configuration:
goreporter:
checks:
- gofmt
- gocyclo
- golint
golangci-lint configuration:
linters:
enable:
- gofmt
- gocyclo
- golint
- govet
- errcheck
golangci-lint offers more granular control over linter configuration and allows for enabling/disabling specific linters. It also includes additional linters like govet
and errcheck
by default.
Both tools aim to improve Go code quality, but golangci-lint provides a more comprehensive and actively maintained solution. goreporter offers a simpler setup and may be easier for beginners, while golangci-lint is more suitable for larger projects and teams requiring extensive customization and a wider range of checks.
Staticcheck - The advanced Go linter
Pros of go-tools
- More comprehensive set of analysis tools, including advanced static analysis
- Actively maintained with frequent updates and bug fixes
- Better integration with popular IDEs and editors
Cons of go-tools
- Steeper learning curve due to more complex toolset
- May be overkill for smaller projects or beginners
- Requires more configuration and setup compared to goreporter
Code Comparison
goreporter example:
goreporter -p ./... -f html -r report.html
go-tools example:
staticcheck ./...
gosimple ./...
unused ./...
Summary
go-tools offers a more comprehensive and actively maintained set of analysis tools for Go projects, with better IDE integration. However, it has a steeper learning curve and may be more complex to set up compared to goreporter. goreporter provides a simpler, all-in-one solution that generates a single report, while go-tools offers individual tools for specific analyses. The choice between the two depends on project size, team expertise, and specific analysis needs.
Go security checker
Pros of gosec
- Focused specifically on security issues in Go code
- Integrates well with CI/CD pipelines and other security tools
- Regularly updated with new security checks and improvements
Cons of gosec
- Limited to security-related checks, not a comprehensive code quality tool
- May produce false positives that require manual review
- Less extensive reporting options compared to goreporter
Code Comparison
gosec example:
package main
import (
"crypto/md5"
"fmt"
"io"
)
func main() {
h := md5.New() // gosec will flag this as insecure
io.WriteString(h, "test")
fmt.Printf("%x", h.Sum(nil))
}
goreporter example:
package main
import "fmt"
func main() {
var x int
fmt.Println(x) // goreporter may flag this as an unused variable
}
gosec focuses on identifying security vulnerabilities, while goreporter provides a broader analysis of code quality and potential issues.
🔥 ~6x faster, stricter, configurable, extensible, and beautiful drop-in replacement for golint
Pros of revive
- More actively maintained with frequent updates
- Extensive set of rules (70+) for linting Go code
- Highly configurable with the ability to enable/disable specific rules
Cons of revive
- Focuses solely on linting, lacking some of goreporter's additional features
- May require more setup and configuration to achieve desired results
Code comparison
revive:
package main
import "github.com/mgechev/revive/lint"
func main() {
lint.Run(lint.Config{})
}
goreporter:
package main
import "github.com/qax-os/goreporter"
func main() {
goreporter.Run()
}
Summary
revive is a more focused and actively maintained linting tool for Go, offering a wide range of customizable rules. It excels in providing detailed code analysis and style checks. goreporter, on the other hand, offers a broader set of features beyond linting, including test coverage and dependency analysis. While revive may require more initial setup, it provides greater flexibility in tailoring the linting process to specific project needs. The choice between the two depends on whether you need a specialized linting tool (revive) or a more comprehensive code quality reporter (goreporter).
DEPRECATED: Use https://github.com/golangci/golangci-lint
Pros of gometalinter
- Supports a wide range of linters (over 20) out of the box
- Allows concurrent execution of linters, improving performance
- Provides a unified interface for multiple linters, simplifying usage
Cons of gometalinter
- No longer actively maintained (archived repository)
- Can be slower for large projects due to running multiple linters
- Configuration can be complex due to the number of supported linters
Code Comparison
gometalinter:
install:
go get -u github.com/alecthomas/gometalinter
gometalinter --install --update
lint:
gometalinter ./...
goreporter:
go get -u github.com/qax-os/goreporter
goreporter -p [projectRelativePath] -r [reportPath] -e [exceptPackages] -f [json/html/text]
While both tools aim to improve Go code quality, gometalinter offers a broader range of linters and concurrent execution. However, it's no longer actively maintained. goreporter, on the other hand, is still actively developed and provides a more focused set of analysis tools, including some unique features like testing coverage and cyclomatic complexity analysis. The choice between the two depends on specific project needs and the importance of ongoing maintenance.
A Golang tool that does static analysis, unit testing, code review and generate code quality report.
Pros of goreporter
- More active development and recent updates
- Broader range of analysis tools and metrics
- Better documentation and usage instructions
Cons of goreporter
- Potentially higher resource usage due to more comprehensive analysis
- May have a steeper learning curve for new users
Code comparison
goreporter:
func (r *Reporter) RunReporters() {
for _, reporter := range r.Reporters {
reporter.Run(r.ProjectPath)
}
}
goreporter>:
func (r *Reporter) Run() {
r.runLinters()
r.generateReport()
}
The code comparison shows that goreporter uses a more modular approach with separate reporter instances, while goreporter> has a simpler structure with predefined linting and reporting steps.
Both projects aim to provide code quality analysis for Go projects, but goreporter appears to be more actively maintained and feature-rich. It offers a wider range of analysis tools and metrics, which can be beneficial for larger projects or teams seeking comprehensive code quality insights.
However, the additional features in goreporter may come at the cost of increased complexity and resource usage. Users with simpler requirements or those working on smaller projects might find goreporter> sufficient for their needs.
Ultimately, the choice between the two repositories depends on the specific requirements of the project and the level of detail needed in the code analysis process.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
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
- Supported template
- Todo List
- Installing
- Run it
- Quickstart
- Example
- Report-example
- Credits
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 <file>
.
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
Top Related Projects
Fast linters runner for Go
Staticcheck - The advanced Go linter
Go security checker
🔥 ~6x faster, stricter, configurable, extensible, and beautiful drop-in replacement for golint
DEPRECATED: Use https://github.com/golangci/golangci-lint
A Golang tool that does static analysis, unit testing, code review and generate code quality report.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot