reviewdog — A code review dog who keeps your codebase healthy

sample PR
Run reviewdog locally

Background

Installation

go get -u github.com/haya14busa/reviewdog/cmd/reviewdog

Usage

Run locally to filter results by diff

# check golint results with `git diff master`
$ golint ./... | reviewdog -f=golint -diff="git diff master"
# sample -efm (errorformat)
$ golint ./... | reviewdog -efm="%f:%l:%c: %m" -diff="git diff"

Run in CI service (Circle CI) to post review comments

test:
pre:
- go get github.com/haya14busa/reviewdog/cmd/reviewdog
override:
- >-
go tool vet -all -shadowstrict . 2>&1 | reviewdog -f=govet -ci="circle-ci"

‘errorformat’ —scanf-like string to parse lint result

$ cat testdata/sbt.in
[warn] /path/to/F1.scala:203: local val in method f is never used: (warning smaple 3)
[warn] val x = 1
[warn] ^
[warn] /path/to/F1.scala:204: local val in method f is never used: (warning smaple 2)
[warn] val x = 2
[warn] ^
[error] /path/to/F2.scala:1093: error: value ++ is not a member of Int
[error] val x = 1 ++ 2
[error] ^
[warn] /path/to/dir/F3.scala:83: local val in method f is never used
[warn] val x = 4
[warn] ^
[error] /path/to/dir/F3.scala:84: error: value ++ is not a member of Int
[error] val x = 5 ++ 2
[error] ^
[warn] /path/to/dir/F3.scala:86: local val in method f is never used
[warn] val x = 6
[warn] ^
$ errorformat "%E[%t%.%+] %f:%l: error: %m" "%A[%t%.%+] %f:%l: %m" "%Z[%.%+] %p^" "%C[%.%+] %.%#" "%-G%.%#" < testdata/sbt.in
/path/to/F1.scala|203 col 13 warning| local val in method f is never used: (warning smaple 3)
/path/to/F1.scala|204 col 7 warning| local val in method f is never used: (warning smaple 2)
/path/to/F2.scala|1093 col 15 error| value &#43;&#43; is not a member of Int
/path/to/dir/F3.scala|83 col 13 warning| local val in method f is never used
/path/to/dir/F3.scala|84 col 19 error| value &#43;&#43; is not a member of Int
/path/to/dir/F3.scala|86 col 13 warning| local val in method f is never used
$ golint ./... | reviewdog -f=golint -diff="git diff master"

Have a reviewdog and keep your codebase healthy!

--

--

--

V!mm!shment Th!s World! https://github.com/haya14busa

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
haya14busa

haya14busa

V!mm!shment Th!s World! https://github.com/haya14busa

More from Medium

What is the best option for patching and mocking function/variable/constants in go?

Debounce and throttle ActiveJob easiest way

Error: .size expression for copy_user_generic_c does not evaluate to a constant | linux kernel 2.6.*