Automated Code Reviews for Go¶
By default, we enable code rating, code metrics and duplicate code detection. The minimal configuration for a Go project looks as follows:
checks:
go: true
build:
environment:
go: go1.9.2
nodes:
analysis:
tests:
override:
- go-scrutinizer-run
go-scrutinizer-run
will run Go Scrutinizer, a Go analysis engine that provids static code analysis, code metrics and duplicate code detection.
Open-Source Analysis Tools¶
Scrutinizer also provide integration support for open source tools, such as Go Vet and Golint.
Go Vet¶
To enable govet
, simply add following lines in your configuration:
build:
environment:
go: go1.9.2
nodes:
analysis:
tests:
override:
- govet-run
Golint¶
To enable golint
, simply add following lines in your configuration:
build:
environment:
go: go1.9.2
nodes:
analysis:
tests:
override:
- golint-run
In general, we support all tools that produce results in the common checkstyle format. For example, using Go Meta Linter in Scrutinizer will be:
build:
environment:
go: go1.9.2
nodes:
analysis:
tests:
before:
- go get -u github.com/alecthomas/gometalinter
- gometalinter --install
override:
-
command: gometalinter ./... --checkstyle > result.xml
analysis:
file: 'result.xml'
format: 'general-checkstyle'
If you would like to run a tool that produces a different format that we do not support yet, just drop us a line at support@scrutinizer-ci.com.
Analyzed Files¶
By default, Scrutinizer will analyze all files ending with .go
in your project. If you have generated code, or
dependencies embedded in your project, or would like to exclude your tests from the analysis, this can be achieved easily:
filter:
excluded_paths:
- test/*
Learn more about excluding files from the analysis.