Skip to content

Commit

Permalink
Merge pull request #59 from haya14busa/project-run7-doc
Browse files Browse the repository at this point in the history
Document for Project Configuration Based Run
  • Loading branch information
haya14busa committed Dec 15, 2016
2 parents 3b1c916 + cb1b43a commit 202bb33
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions README.md
Expand Up @@ -118,6 +118,49 @@ Also, if you want to pass other Json/XML/etc... format to reviewdog, you can wri
$ <linter> | <convert-to-checkstyle> | reviewdog -f=checkstyle -name="<linter>" -ci="circle-ci"
```

### Project Configuration Based Run

[experimental]

reviewdog can also be controlled via the reviewdog.yml configuration file instead of "-f" or "-efm" arguments.

With reviewdog.yml, you can run the same commands both CI service and local
environment including editor intergration with ease.

#### reviewdog.yml

```yaml
runner:
<tool-name>:
cmd: <command> # (required)
errorformat: # (optional if there is supporeted format for <tool-name>. see reviewdog -list)
- <list of errorformat>
name: <tool-name> # (optional. you can overwrite <tool-name> defined by runner key)

# examples
golint:
cmd: golint ./...
errorformat:
- "%f:%l:%c: %m"
govet:
cmd: go tool vet -all -shadowstrict .
```

```
$ reviewdog -diff="git diff master"
project/run_test.go:61:28: [golint] error strings should not end with punctuation
project/run.go:57:18: [errcheck] defer os.Setenv(name, os.Getenv(name))
project/run.go:58:12: [errcheck] os.Setenv(name, "")
# You can use -conf to specify config file path.
$ reviewdog -ci=droneio -conf=./reviewdog.yml
```

Output format for project config based run is one of following formats.

- `<file>: [<tool name>] <message>`
- `<file>:<lnum>: [<tool name>] <message>`
- `<file>:<lnum>:<col>: [<tool name>] <message>`

### Run locally

reviewdog can find new introduced warnings or error by filtering linter results
Expand Down

0 comments on commit 202bb33

Please sign in to comment.