GithubHelp home page GithubHelp logo

reviewdog / reviewdog Goto Github PK

View Code? Open in Web Editor NEW
7.4K 53.0 395.0 4.11 MB

๐Ÿถ Automated code review tool integrated with any code analysis tools regardless of programming language

Home Page: https://medium.com/@haya14busa/reviewdog-a-code-review-dog-who-keeps-your-codebase-healthy-d957c471938b#.8xctbaw5u

License: MIT License

Go 96.52% Shell 2.18% HTML 1.15% Dockerfile 0.15%
linter go lint ci code-review github gitlab codereview cli code-quality

reviewdog's People

Contributors

bgpat avatar carl-printreleaf avatar carmanchris31 avatar dependabot[bot] avatar epmatt avatar haya14busa avatar i-sevostyanov avatar irgaly avatar jsoref avatar lafriks avatar lgellrich avatar massongit avatar mavimo avatar mgrachev avatar mheap avatar nakatanakatana avatar nmotod avatar oohira avatar polamjag avatar renovate-bot avatar renovate[bot] avatar roobre avatar shogo82148 avatar sivchari avatar step-security-bot avatar taraspos avatar timakin avatar trim21 avatar tsuyoshicho avatar warashi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

reviewdog's Issues

-reporter=github-pr-check doesn't work for private repo?

failed to run checker: fail to parse diff: GET https://api.github.com/repos/xxx/xxx/pulls/xxx: 403 Resource not accessible by integration []

reviewdog doesn't have necessary permission? It has read permission of pull requests, so i wonder why...

Error retrieving token for reviewdog.app

I went to https://reviewdog.app/gh/{owner}/{repo} to get my token after setting up the GitHub integration and got this error. When I login at reviewdog.app, it shows that my account is successfully connected. Anything else I can try?

failed to get repo: &github.ErrorResponse{Response:(*http.Response)(0xc008515170), Message:"Resource not accessible by integration", Errors:[]github.Error(nil), Block:(*struct { Reason string "json:\"reason,omitempty\""; CreatedAt *github.Timestamp "json:\"created_at,omitempty\"" })(nil), DocumentationURL:"https://developer.github.com/v3/repos/#get"}

run reviewdog using project based config

Use reviewdog.yml in the root project to run reviewdog might be useful.

For now, we have to add -ci or -diff arg in accordance with the situation, so we cannot run lint easily both in local and CI server.

By using reviewdog conf file, we can run reviewdog $ reviewdog [-diff="git diff master"] or $ reviewdog -ci=droneio. It's really easy to run and easy to integrate with editor or commit hook.

Security

In CI server, reviewdog needs secret GitHub API token and attackers can create pull-request to get secret token if CI service is not secure.
Drone.io handles this problem with checksum of yml file, but if we introduce reviewdog conf file, checksum of drone.yml doesn't protect the secret token.

To handle this problem, reviewdog can store secret token in memory, remove secret env var, and run linter commands

Running a private reviewdog server

I'd like to be able to run a private reviewdog server, so that we can use the github-pr-check reporter against GitHub Enterprise. Do you have the source code and/or any documentation on the server?

Support Pull Request Reviews for GitHub Enterprise

Hello, haya14busa! Thanks for this great tool!

I can see in the code that reviewdog knows how to post comments in one big review but the behavior is disabled for Enterprise users. From what I can tell the Enterprise API now supports reviews. Can we get that feature enabled?

git merge-base fails in Jenkins Multi-branch workspace when branch becomes not ff-mergable

reviewdog get diffs using git merge-base, but in Jenkins multi-branch workspace, this fails in some condition (and I think reviewdog can do nothing about it...).

Situation

Jenkins multi-branch plugin fetches only target branch by following git fetch, which only obtains target branch's change.

git fetch --no-tags --progress git@myserver:myrepository.git +refs/heads/MyBranch:refs/remotes/origin/MyBranch

And reviewdog determines base commit using github pull request api.

In following situation the base commit obtained by github api does not exist in workspace, therefore git merge-base fails.

  • MyBranch, which is ff-mergable to BaseBranch is pushed to Jenkins
    • at this time, BaseBranch's HEAD is exists in workspace so reviewdog can work properly
  • Some new commit is added to BaseBranch
  • MyBranch is pushed again
    • at this time, MyBranch is not ff-mergable to BaseBranch
    • jenkins only obtains changes in MyBranch by git fetch, so new commits in BaseBranch does not exist in this workspace
    • reviewdog tries to git merge-base, but fails because HEAD of BaseBranch does not exist in the workspace.

Possible solution

I think reviewdog can do nothing about it ๐Ÿ˜ญ
Jenkins, or users should call git fetch BaseBranch before calling reviewdog.

Looking for maintainers

The maintenance of this project seems to be stopped.

@haya14busa If you have enough time for maintenance, I'm going to support you.
What do you think about moving the reviewdog repository to an organization?

get diff returns 404 from GitHub API on private repo

I'm using reviewdog on an open source project and it works great. I'm trying to run it now on a private repo and it isn't working. I'm running on CircleCI and I have REVIEWDOG_GITHUB_API_TOKEN set. I verified that the api token user is a collaborator on the private repo. Is reviewdog using the api token when it accesses the diff?

#!/bin/bash -eo pipefail
go tool vet -all -shadowstrict . 2>&1 | reviewdog -f=govet -ci="circle-ci"
reviewdog: fail to get diff: GET https://api.github.com/repos/my/repo/pulls/268: 404 Not Found []
Exited with code 1

Doghouse server is broken after Github API changes

I am trying to run golint on a subdirectory in my repo using this command:

golint -set_exit_status ./pkg/... | reviewdog -f=golint -diff="git diff origin/master" -reporter=github-pr-check

But it is giving me a 422 Invalid request error - along with the message: "annotation_level", "path" weren't supplied. []

I can get this to run successfully by changing my command to this:

cd pkg && golint -set_exit_status ./... | reviewdog -f=golint -diff="git diff origin/master" -reporter=github-pr-check

But then the links referenced in the errors don't include the pkg folder, so they don't work.

I there a reviewdog flag I need to include to be able to make one of the above run commands work properly?

Parsers should be able to return results for multiple tools

Golang CI is a great tool, collecting a number of Go linting tools in one binary. It is capable of outputting a checkstyle format (and a custom json format as well) which can contain the actual linter which raised an issue.

It would be nice, if the actual tool could be detected by the parser itself.

Authentication with repository API tokens is unsafe for PR builds

Reviewdog is specifically designed to run in CI's PR/MR builds, in order to generate code reviews.

In these conditions it's not safe to use private environment variables. PR's should be regarded as "untrusted code" and not run in CI's with access to private information before they're accepted (which is what the CI build does).

Even if the variables aren't being added as clear text, the author of the PR can add a keylogger and steal your variables.

Travis has enabled a protection against this, but this also means reviewdog can't access the key.

It's possible to avoid this by using the "checks"-reporter instead, but I prefer code reviews over checks.

This seems like a great tool that I want to use, but this issue is a deal breaker for me. I think the GitHub App has to do this instead, like with your "checks"-reporter or other solutions like stickler-ci or HoundCI.

can't install reviewdog command on Travis-ci

Errors when I try to install reviewdog command on travis-ci:

$ go get github.com/haya14busa/reviewdog/cmd/reviewdog
package github.com/haya14busa/reviewdog/cmd/reviewdog
	imports context: unrecognized import path "context"

The command "go get github.com/haya14busa/reviewdog/cmd/reviewdog" failed and exited with 1 during .

maybe, it's cause that Golang version on travis-ci is 1.4 . (I'm using travis-ci for PHP project. so, i can't change golang version easily.)
ref. go-swagger/go-swagger#679

Comment when file is generally modified/added/deleted

I have a use case where I'd like to make a comment to the reviewer as soon as an RPC data structure is modified. Essentially I want to ask if the deploy of the microservice is backwards compatible. In the best of worlds I'll implement an AST for Java parsing the source code and adding a warning by each field. That said, right now I'd happily just add a comment as soon as an RPC class file changes.

Question: In the readme all error formats contain a line. Is it possible to simply add a generic warning for a whole file (and warn if the file changes)? Any other approach? Is reviewdog the right tool for this?

GitHub: cannot use diff provided by GitHub

I reported below message to GitHub support


application/vnd.github.v3.diff media type is not usable for creating a PullRequest comment to PullRequest with file renames.

Document: https://developer.github.com/v3/pulls/comments/#create-a-comment

To comment on a specific line in a file, you will need to first determine the
position in the diff. GitHub offers a application/vnd.github.v3.diff media
type which you can use in a preceding request to view the pull request's
diff.

Document says that we can get a pull request diff to determin the position in the diff with application/vnd.github.v3.diff media type.
However, diff is not support git diff --find-renames, so we cannot use the diff to determin the position if pull request contains rename file change.

$ curl -H "Accept: application/vnd.github.v3.diff" 'https://api.github.com/repos/haya14busa/reviewdog/pulls/17' > pr17.diff

pr17.diff content is here. https://github.com/haya14busa/reviewdog/pull/17/files#diff-3f1590a5a42dea59fdf7dc68dbcf112c

I'm sorry, but it's not minimum reproducible pull-request, but please see below.

diff --git a/watchdogs.go b/watchdogs.go
deleted file mode 100644
index a1dd247..0000000
--- a/watchdogs.go
+++ /dev/null

https://gist.github.com/haya14busa/d3be48dba9d12e91c60b9a5d711da9b5#file-pr17-diff-L2000-L2004

diff --git a/reviewdog.go b/reviewdog.go
new file mode 100644
index 0000000..ae92e5e
--- /dev/null
+++ b/reviewdog.go

https://gist.github.com/haya14busa/d3be48dba9d12e91c60b9a5d711da9b5#file-pr17-diff-L1719-L1723

In files view (https://github.com/haya14busa/reviewdog/pull/17/files#diff-3f1590a5a42dea59fdf7dc68dbcf112cL1),
this change is handles as watchdogs.go -> reviewdog.go, but diff shows a/watchdogs.go -> /dev/null and /dev/null -> b/reviewdog.go.

So, we cannot determine the position in renamed files because hunk information (@@) is completely lost.

Please add --find-renames equivalent support to application/vnd.github.v3.diff.
Thanks in advance.

Check filtered finding when error is on another line than `git diff`

I'm trying out to create a PHP Linter.

I have a file like this:

public function create()
{
    // i make a mistake below by forgetting the trailing ;  line 33
    blaat()  // <-- line 34
}

My php linter gives the following error:

src/AdminBundle/Job/PostAdminMessageToSlackJob.php:35: PHP Parse error: syntax error, unexpected '$job' (T_VARIABLE)

And Reviewdog marks this finding as filtered:

Findings (0)
Filtered Findings (1)
src/AdminBundle/Job/PostAdminMessageToSlackJob.php:35: PHP Parse error: syntax error, unexpected '$job' (T_VARIABLE)

That's because Reviewdog does a strict lookup for the given row number in the git diff. But in PHP the error will sometimes be on the next line.

Any idea how to solve this?

Doesn't Github allow for adding checks to lines that didn't change? It always shows ยฑ5 lines before and after right? Maybe we can take that margin into account here?

Add documentation for Jenkins

ใ“ใกใ‚‰ใฎใƒ„ใƒผใƒซใ‚’JenkinsไธŠใงๅˆฉ็”จใ•ใ›ใฆใ„ใŸใ ใใพใ—ใŸใ€‚
ใ‚ใ‚ŠใŒใจใ†ใ”ใ–ใ„ใพใ™ใ€‚

ไธ€็‚นใฏใพใฃใŸ้ƒจๅˆ†ใŒใ‚ใ‚‹ใฎใงREADMEใซ่ฟฝ่จ˜ใ—ใฆใŠใ„ใฆใ„ใŸใ ใ‘ใ‚‹ใจๅฌ‰ใ—ใ„ใชใจๆ€ใ„ใพใ™ใ€‚

jenkinsใงGitHub pull request builder pluginใ‚’ไฝฟ็”จใ—ใŸใจใใซCI_COMMITใ‚’ไปฅไธ‹ใฎๅ€คใซใ™ใ‚‹ใจๅคฑๆ•—ใ—ใพใ™ใ€‚

export CI_COMMIT=$(git rev-parse HEAD)

[{Resource:PullRequestReviewComment Field:commit_id Code:custom Message:commit_id is not part of the pull request}]

ใ“ใ‚Œใฏไปฎใซใƒžใƒผใ‚ธใ•ใ‚ŒใŸใ‚ณใƒŸใƒƒใƒˆใงAPIใ‚’ใŸใŸใ„ใฆใ„ใ‚‹ใ‹ใ‚‰ใ ใจๆ€ใ„ใพใ™ใ€‚
ไปฅไธ‹ใฎใ‚ˆใ†ใซใ™ใ‚‹ใจๆญฃใ—ใๆˆๅŠŸใ—ใพใ™ใ€‚

export CI_COMMIT=${ghprbActualCommit}

reviewdog POST api.github.com 422 Validation Failed

tried on Travis always got that https://travis-ci.org/thunderdb/ThunderDB/jobs/371431240 (the last line)

and I also tried on my Macbook with

export TRAVIS=true
export TRAVIS_PULL_REQUEST=1
export TRAVIS_PULL_REQUEST_BRANCH=feature/routing
export TRAVIS_COMMIT=758d84fee7292ef61bcb3d63572ee300bc7cf0cf
export TRAVIS_PULL_REQUEST_SHA=3216c2fd342af8e264a0aa8658dcf9cdb6a5a710
export TRAVIS_REPO_SLUG=thunderdb/ThunderDB
export TRAVIS_SECURE_ENV_VARS=true
export REVIEWDOG_GITHUB_API_TOKEN=xxxxxx

still:
reviewdog: POST https://api.github.com/repos/thunderdb/ThunderDB/pulls/1/reviews: 422 Validation Failed [{Resource: Field: Code: Message:}]

[Bug] using `map` in a concurrent job is unsafe.

Overview

The function Run in project.go accesses map in concurrent jobs in an errgroup closure.
But it sometimes causes fatal error: concurrent map writes .

Detail

When I try to run reviewdog -reporter=local -diff="git diff master" command in a remote CI job (in CircleCI), I came across the error.
An environment where it uses Go (>=1.6) randomly causes fatal error: concurrent map writes, if you try to insert values to map in concurrent processes.
The cause of a panic is them.
https://github.com/haya14busa/reviewdog/blob/master/project/run.go#L19
https://github.com/haya14busa/reviewdog/blob/master/project/run.go#L52

And stacktrace is as follows.

#!/bin/bash -eo pipefail
reviewdog -reporter=local -diff="git diff master"
fatal error: concurrent map writes

goroutine 8 [running]:
runtime.throw(0x7ac15b, 0x15)
	/usr/local/go/src/runtime/panic.go:617 +0x72 fp=0xc000178e40 sp=0xc000178e10 pc=0x42d312
runtime.mapassign_faststr(0x7341a0, 0xc0000137a0, 0xc00001a878, 0x8, 0x0)
	/usr/local/go/src/runtime/map_faststr.go:211 +0x42a fp=0xc000178ea8 sp=0xc000178e40 pc=0x41420a
github.com/haya14busa/reviewdog/project.RunAndParse.func1(0x0, 0x0)
	/go/pkg/mod/github.com/haya14busa/[email protected]/project/run.go:52 +0x2a3 fp=0xc000178f88 sp=0xc000178ea8 pc=0x6d9c73
golang.org/x/sync/errgroup.(*Group).Go.func1(0xc0000137d0, 0xc0000d0a50)
	/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:57 +0x57 fp=0xc000178fd0 sp=0xc000178f88 pc=0x677377
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:1337 +0x1 fp=0xc000178fd8 sp=0xc000178fd0 pc=0x458d51
created by golang.org/x/sync/errgroup.(*Group).Go
	/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:54 +0x66

goroutine 1 [runnable]:
regexp.onePassPrefix(0xc000180a50, 0xc000138990, 0x0, 0x0)
	/usr/local/go/src/regexp/onepass.go:40 +0x20d
regexp.compile(0xc00001bb68, 0x4, 0xd4, 0x40, 0xc00001bb68, 0x4)
	/usr/local/go/src/regexp/regexp.go:198 +0x1e9
regexp.Compile(...)
	/usr/local/go/src/regexp/regexp.go:131
github.com/haya14busa/errorformat.NewEfm(0x7a7193, 0x7, 0xc000091a40, 0x0, 0x0)
	/go/pkg/mod/github.com/haya14busa/[email protected]/errorformat.go:498 +0x94a
github.com/haya14busa/errorformat.NewErrorformat(0xc00000e380, 0x2, 0x2, 0x8123e0, 0xc0001341a8, 0x50)
	/go/pkg/mod/github.com/haya14busa/[email protected]/errorformat.go:38 +0xcc
github.com/haya14busa/reviewdog.NewErrorformatParserString(0xc00000e380, 0x2, 0x2, 0x5, 0xc000134228, 0x1)
	/go/pkg/mod/github.com/haya14busa/[email protected]/parser.go:60 +0x43
github.com/haya14busa/reviewdog.NewParser(0xc0000efbb0, 0x8123e0, 0x0, 0x0, 0x0)
	/go/pkg/mod/github.com/haya14busa/[email protected]/parser.go:42 +0xfe
github.com/haya14busa/reviewdog/project.RunAndParse(0x821220, 0xc00001a068, 0xc000010058, 0xc000010058, 0x0, 0x0)
	/go/pkg/mod/github.com/haya14busa/[email protected]/project/run.go:32 +0x1f6
github.com/haya14busa/reviewdog/project.Run(0x821220, 0xc00001a068, 0xc000010058, 0x81aca0, 0xc000090d50, 0x81da00, 0xc0000d0410, 0x789901, 0xc0000cd790)
	/go/pkg/mod/github.com/haya14busa/[email protected]/project/run.go:64 +0x5d
main.run(0x81b140, 0xc000010010, 0x81b160, 0xc000010018, 0xa54aa0, 0x0, 0xc0000200b8)
	/go/pkg/mod/github.com/haya14busa/[email protected]/cmd/reviewdog/main.go:248 +0x3c6
main.main()
	/go/pkg/mod/github.com/haya14busa/[email protected]/cmd/reviewdog/main.go:139 +0xd2

goroutine 5 [select]:
os/exec.(*Cmd).Start.func2(0xc00010a840)
	/usr/local/go/src/os/exec/exec.go:416 +0xc4
created by os/exec.(*Cmd).Start
	/usr/local/go/src/os/exec/exec.go:415 +0x62d

goroutine 7 [select]:
os/exec.(*Cmd).Start.func2(0xc00010a9a0)
	/usr/local/go/src/os/exec/exec.go:416 +0xc4
created by os/exec.(*Cmd).Start
	/usr/local/go/src/os/exec/exec.go:415 +0x62d

goroutine 9 [select]:
os/exec.(*Cmd).Start.func2(0xc00010ab00)
	/usr/local/go/src/os/exec/exec.go:416 +0xc4
created by os/exec.(*Cmd).Start
	/usr/local/go/src/os/exec/exec.go:415 +0x62d

goroutine 10 [IO wait]:
internal/poll.runtime_pollWait(0x7fa97b19fb88, 0x72, 0xffffffffffffffff)
	/usr/local/go/src/runtime/netpoll.go:182 +0x56
internal/poll.(*pollDesc).wait(0xc0000a7038, 0x72, 0x1001, 0x1000, 0xffffffffffffffff)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:87 +0x9b
internal/poll.(*pollDesc).waitRead(...)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:92
internal/poll.(*FD).Read(0xc0000a7020, 0xc00017d000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
	/usr/local/go/src/internal/poll/fd_unix.go:169 +0x19b
os.(*File).read(...)
	/usr/local/go/src/os/file_unix.go:263
os.(*File).Read(0xc0000101c8, 0xc00017d000, 0x1000, 0x1000, 0xc000078488, 0x4426ec, 0x1000)
	/usr/local/go/src/os/file.go:108 +0x70
io.(*multiReader).Read(0xc00016e060, 0xc00017d000, 0x1000, 0x1000, 0x0, 0xc000172070, 0x0)
	/usr/local/go/src/io/multi.go:26 +0xac
bufio.(*Scanner).Scan(0xc000170080, 0x0)
	/usr/local/go/src/bufio/scan.go:213 +0xa4
github.com/haya14busa/errorformat.(*Scanner).Scan(0xc000179e70, 0xc000172070)
	/go/pkg/mod/github.com/haya14busa/[email protected]/errorformat.go:167 +0x33
github.com/haya14busa/reviewdog.(*ErrorformatParser).Parse(0xc0000101c0, 0x81ae80, 0xc00016e060, 0x2, 0xc000078758, 0x2, 0x2, 0x2)
	/go/pkg/mod/github.com/haya14busa/[email protected]/parser.go:70 +0x121
github.com/haya14busa/reviewdog/project.RunAndParse.func1(0x0, 0x0)
	/go/pkg/mod/github.com/haya14busa/[email protected]/project/run.go:48 +0x238
golang.org/x/sync/errgroup.(*Group).Go.func1(0xc0000137d0, 0xc0000d0b40)
	/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:57 +0x57
created by golang.org/x/sync/errgroup.(*Group).Go
	/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:54 +0x66

goroutine 11 [select]:
os/exec.(*Cmd).Start.func2(0xc00010ac60)
	/usr/local/go/src/os/exec/exec.go:416 +0xc4
created by os/exec.(*Cmd).Start
	/usr/local/go/src/os/exec/exec.go:415 +0x62d

goroutine 12 [IO wait]:
internal/poll.runtime_pollWait(0x7fa97b19f9e8, 0x72, 0xffffffffffffffff)
	/usr/local/go/src/runtime/netpoll.go:182 +0x56
internal/poll.(*pollDesc).wait(0xc0000a7278, 0x72, 0x1001, 0x1000, 0xffffffffffffffff)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:87 +0x9b
internal/poll.(*pollDesc).waitRead(...)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:92
internal/poll.(*FD).Read(0xc0000a7260, 0xc000194000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
	/usr/local/go/src/internal/poll/fd_unix.go:169 +0x19b
os.(*File).read(...)
	/usr/local/go/src/os/file_unix.go:263
os.(*File).Read(0xc000010210, 0xc000194000, 0x1000, 0x1000, 0xc00017bc88, 0x4426ec, 0x1000)
	/usr/local/go/src/os/file.go:108 +0x70
io.(*multiReader).Read(0xc00016e0a0, 0xc000194000, 0x1000, 0x1000, 0x0, 0xc0001720e0, 0x0)
	/usr/local/go/src/io/multi.go:26 +0xac
bufio.(*Scanner).Scan(0xc000170100, 0x0)
	/usr/local/go/src/bufio/scan.go:213 +0xa4
github.com/haya14busa/errorformat.(*Scanner).Scan(0xc00017be70, 0xc0001720e0)
	/go/pkg/mod/github.com/haya14busa/[email protected]/errorformat.go:167 +0x33
github.com/haya14busa/reviewdog.(*ErrorformatParser).Parse(0xc000010208, 0x81ae80, 0xc00016e0a0, 0x2, 0xc000079758, 0x2, 0x2, 0x2)
	/go/pkg/mod/github.com/haya14busa/[email protected]/parser.go:70 +0x121
github.com/haya14busa/reviewdog/project.RunAndParse.func1(0x0, 0x0)
	/go/pkg/mod/github.com/haya14busa/[email protected]/project/run.go:48 +0x238
golang.org/x/sync/errgroup.(*Group).Go.func1(0xc0000137d0, 0xc0000d0c30)
	/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:57 +0x57
created by golang.org/x/sync/errgroup.(*Group).Go
	/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:54 +0x66

goroutine 13 [select]:
os/exec.(*Cmd).Start.func2(0xc00010adc0)
	/usr/local/go/src/os/exec/exec.go:416 +0xc4
created by os/exec.(*Cmd).Start
	/usr/local/go/src/os/exec/exec.go:415 +0x62d

goroutine 14 [IO wait]:
internal/poll.runtime_pollWait(0x7fa97b19f848, 0x72, 0xffffffffffffffff)
	/usr/local/go/src/runtime/netpoll.go:182 +0x56
internal/poll.(*pollDesc).wait(0xc0000a74b8, 0x72, 0x1001, 0x1000, 0xffffffffffffffff)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:87 +0x9b
internal/poll.(*pollDesc).waitRead(...)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:92
internal/poll.(*FD).Read(0xc0000a74a0, 0xc000169000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
	/usr/local/go/src/internal/poll/fd_unix.go:169 +0x19b
os.(*File).read(...)
	/usr/local/go/src/os/file_unix.go:263
os.(*File).Read(0xc000010258, 0xc000169000, 0x1000, 0x1000, 0xc00007a488, 0x4426ec, 0x1000)
	/usr/local/go/src/os/file.go:108 +0x70
io.(*multiReader).Read(0xc000162060, 0xc000169000, 0x1000, 0x1000, 0x0, 0xc000166070, 0x0)
	/usr/local/go/src/io/multi.go:26 +0xac
bufio.(*Scanner).Scan(0xc000164080, 0x0)
	/usr/local/go/src/bufio/scan.go:213 +0xa4
github.com/haya14busa/errorformat.(*Scanner).Scan(0xc00008ae70, 0xc000166070)
	/go/pkg/mod/github.com/haya14busa/[email protected]/errorformat.go:167 +0x33
github.com/haya14busa/reviewdog.(*ErrorformatParser).Parse(0xc000010250, 0x81ae80, 0xc000162060, 0x2, 0xc00007a758, 0x2, 0x2, 0x2)
	/go/pkg/mod/github.com/haya14busa/[email protected]/parser.go:70 +0x121
github.com/haya14busa/reviewdog/project.RunAndParse.func1(0x0, 0x0)
	/go/pkg/mod/github.com/haya14busa/[email protected]/project/run.go:48 +0x238
golang.org/x/sync/errgroup.(*Group).Go.func1(0xc0000137d0, 0xc0000d0d20)
	/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:57 +0x57
created by golang.org/x/sync/errgroup.(*Group).Go
	/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:54 +0x66

goroutine 15 [select]:
os/exec.(*Cmd).Start.func2(0xc00010af20)
	/usr/local/go/src/os/exec/exec.go:416 +0xc4
created by os/exec.(*Cmd).Start
	/usr/local/go/src/os/exec/exec.go:415 +0x62d

goroutine 16 [IO wait]:
internal/poll.runtime_pollWait(0x7fa97b19f6a8, 0x72, 0xffffffffffffffff)
	/usr/local/go/src/runtime/netpoll.go:182 +0x56
internal/poll.(*pollDesc).wait(0xc0000a76f8, 0x72, 0x1001, 0x1000, 0xffffffffffffffff)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:87 +0x9b
internal/poll.(*pollDesc).waitRead(...)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:92
internal/poll.(*FD).Read(0xc0000a76e0, 0xc00019a000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
	/usr/local/go/src/internal/poll/fd_unix.go:169 +0x19b
os.(*File).read(...)
	/usr/local/go/src/os/file_unix.go:263
os.(*File).Read(0xc0000102a0, 0xc00019a000, 0x1000, 0x1000, 0xc00008bc88, 0x4426ec, 0x1000)
	/usr/local/go/src/os/file.go:108 +0x70
io.(*multiReader).Read(0xc0001620a0, 0xc00019a000, 0x1000, 0x1000, 0x0, 0xc0001660e0, 0x0)
	/usr/local/go/src/io/multi.go:26 +0xac
bufio.(*Scanner).Scan(0xc000164100, 0x0)
	/usr/local/go/src/bufio/scan.go:213 +0xa4
github.com/haya14busa/errorformat.(*Scanner).Scan(0xc00008be70, 0xc0001660e0)
	/go/pkg/mod/github.com/haya14busa/[email protected]/errorformat.go:167 +0x33
github.com/haya14busa/reviewdog.(*ErrorformatParser).Parse(0xc000010298, 0x81ae80, 0xc0001620a0, 0x2, 0xc00007b758, 0x2, 0x2, 0x2)
	/go/pkg/mod/github.com/haya14busa/[email protected]/parser.go:70 +0x121
github.com/haya14busa/reviewdog/project.RunAndParse.func1(0x0, 0x0)
	/go/pkg/mod/github.com/haya14busa/[email protected]/project/run.go:48 +0x238
golang.org/x/sync/errgroup.(*Group).Go.func1(0xc0000137d0, 0xc0000d0e10)
	/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:57 +0x57
created by golang.org/x/sync/errgroup.(*Group).Go
	/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:54 +0x66

goroutine 18 [select]:
os/exec.(*Cmd).Start.func2(0xc00010b080)
	/usr/local/go/src/os/exec/exec.go:416 +0xc4
created by os/exec.(*Cmd).Start
	/usr/local/go/src/os/exec/exec.go:415 +0x62d

goroutine 19 [IO wait]:
internal/poll.runtime_pollWait(0x7fa97b19f508, 0x72, 0xffffffffffffffff)
	/usr/local/go/src/runtime/netpoll.go:182 +0x56
internal/poll.(*pollDesc).wait(0xc0000a7938, 0x72, 0x1001, 0x1000, 0xffffffffffffffff)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:87 +0x9b
internal/poll.(*pollDesc).waitRead(...)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:92
internal/poll.(*FD).Read(0xc0000a7920, 0xc000195000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
	/usr/local/go/src/internal/poll/fd_unix.go:169 +0x19b
os.(*File).read(...)
	/usr/local/go/src/os/file_unix.go:263
os.(*File).Read(0xc0000102e8, 0xc000195000, 0x1000, 0x1000, 0xc0001a0488, 0x4426ec, 0x1000)
	/usr/local/go/src/os/file.go:108 +0x70
io.(*multiReader).Read(0xc00016e0e0, 0xc000195000, 0x1000, 0x1000, 0x0, 0xc000172150, 0x0)
	/usr/local/go/src/io/multi.go:26 +0xac
bufio.(*Scanner).Scan(0xc000170180, 0x0)
	/usr/local/go/src/bufio/scan.go:213 +0xa4
github.com/haya14busa/errorformat.(*Scanner).Scan(0xc000174e70, 0xc000172150)
	/go/pkg/mod/github.com/haya14busa/[email protected]/errorformat.go:167 +0x33
github.com/haya14busa/reviewdog.(*ErrorformatParser).Parse(0xc0000102e0, 0x81ae80, 0xc00016e0e0, 0x2, 0xc0001a0758, 0x2, 0x2, 0x2)
	/go/pkg/mod/github.com/haya14busa/[email protected]/parser.go:70 +0x121
github.com/haya14busa/reviewdog/project.RunAndParse.func1(0x0, 0x0)
	/go/pkg/mod/github.com/haya14busa/[email protected]/project/run.go:48 +0x238
golang.org/x/sync/errgroup.(*Group).Go.func1(0xc0000137d0, 0xc0000d0f00)
	/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:57 +0x57
created by golang.org/x/sync/errgroup.(*Group).Go
	/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:54 +0x66

goroutine 20 [runnable]:
os/exec.(*Cmd).Start.func2(0xc00010b1e0)
	/usr/local/go/src/os/exec/exec.go:416 +0xc4
created by os/exec.(*Cmd).Start
	/usr/local/go/src/os/exec/exec.go:415 +0x62d

goroutine 21 [runnable]:
golang.org/x/sync/errgroup.(*Group).Go.func1(0xc0000137d0, 0xc0000d0ff0)
	/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:54
created by golang.org/x/sync/errgroup.(*Group).Go
	/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:54 +0x66
Exited with code 2

Environment

go version: 1.11
reviewdog version: 0.9.11
docker image: circleci/golang:1.11

I cannot truly get how the `diff` option works

My lint tool is outputting data in flycheck format:

lib/wallet_web/views/error_helpers.ex:13: F: Pipe chain should start with a raw value.

Which is pretty simple efm: %f:%l: %t: %m,%f:%l:%c: %t: %m (works perfectly in NeoVim). Additionally I have git diff output that contain:

diff --git a/lib/wallet_web/views/error_helpers.ex b/lib/wallet_web/views/error_helpers.ex
index ef43fe2..ed63698 100644
--- a/lib/wallet_web/views/error_helpers.ex
+++ b/lib/wallet_web/views/error_helpers.ex
@@ -9,7 +9,8 @@ defmodule WalletWeb.ErrorHelpers do
   Generates tag for inlined form input errors.
   """
   def error_tag(form, field) do
-    Enum.map(Keyword.get_values(form.errors, field), fn error ->
+    Keyword.get_values(form.errors, field)
+    |> Enum.map(fn error ->
       content_tag(:span, translate_error(error), class: "help-block")
     end)
   end

So as you can see, the 13 line in file lib/wallet_web/views/error_helpers.ex has changed and is the added one.

So why reviewdog -diff="git diff" results with no data? Is there anything wrong with my setup?

runner:
  credo:
    cmd: mix credo suggest --format=flycheck
    errorformat:
      - '%f:%l:%c: %t: %m'
      - '%f:%l: %t: %m'

Is there any option to see the filtered out lines and reason why that line was filtered out?


Tested with precompiled binaries for 0.9.11 (which reports 0.9.10 when reviewdog -version by the way) and with current HEAD (ffb00ef).

ProjectConf: support files/directories/etc... based run

cont #47

With #47, reviewdog behavior can be configured by reviewdog.yml.
However, we cannot specify changed files, directories, or whatever with reviewdog.yml.

Example without reviewdog.yml:

$ vint $(git diff --name-only master | grep '.vim') | reviewdog -diff="git diff master" -efm="%f:%l:%c: %m"
autoload/vital/__vital__/Data/String.vim:9:11: Prefer single quoted strings (see Google VimScript Style Guide (Strings))

go get failed unless GO111MODULE=on

This is expected behavior?

% go version
go version go1.12.4 darwin/amd64

% go get -u github.com/reviewdog/reviewdog/cmd/reviewdog
package github.com/google/go-github/v24/github: cannot find package "github.com/google/go-github/v24/github" in any of:
        /usr/local/Cellar/go/1.12.4/libexec/src/github.com/google/go-github/v24/github (from $GOROOT)
        /Users/hamakn/dev/src/github.com/google/go-github/v24/github (from $GOPATH)

% GO111MODULE=on go get -u github.com/reviewdog/reviewdog/cmd/reviewdog
// OK if there is no Gopkg.lock

Cannot 'go get' due to some API changes in go-github

I tried to install the command with go get but failed. It seems go-github changed some of the APIs (see google/go-github#529).

$ go get -u github.com/haya14busa/reviewdog/cmd/reviewdog 
# github.com/haya14busa/reviewdog
./github.go:132: not enough arguments in call to g.cli.PullRequests.CreateReview
        have (string, string, int, *github.PullRequestReviewRequest)
        want ("context".Context, string, string, int, *github.PullRequestReviewRequest)
./github.go:151: not enough arguments in call to g.cli.PullRequests.CreateComment
        have (string, string, int, *github.PullRequestComment)
        want ("context".Context, string, string, int, *github.PullRequestComment)
./github.go:190: not enough arguments in call to g.cli.PullRequests.Get
        have (string, string, int)
        want ("context".Context, string, string, int)
./github.go:208: not enough arguments in call to g.cli.PullRequests.ListComments
        have (string, string, int, nil)
        want ("context".Context, string, string, int, *github.PullRequestListCommentsOptions)

stop command when parse a very long line linter text

$ cat linter.log
text
text text
............ very long line (stop parsing in this lines
reviewdog target line
text
$ cat linter.log | reviewdog -efm="%f(%l,%c): %m" -diff="git diff develop" 

my linter.log has 15178 characters in the largest line.

now, avoid this case, I use cut command:

$ cat linter.log | cut -b-10240 | reviewdog ...
reviewdog target line

Is this a bug?

Thanks.

PS.
reviewdog is nice tool ๐Ÿ˜„
Thanks again.

[Propose] Support of .netrc file

Some CI systems use .netrc file to authenticate to Github, and allowing reviewdog to use it reduces the trouble of setting REVIEWDOG_GITHUB_API_TOKEN variable.

-reporter=github-pr-review doesn't work on private repo

We have reviewdog working with github-pr-review on our public repos, but it isn't working on our private repo. It is running in CircleCI and it shows that it is exiting with a golint suggestion, but then the review never posts to the PR. The personal token has all repo permissions and is only in use by reviewdog, which shows recent usage, so the token is being used at some point. Do you have any suggestions on how to debug this further?

PS. I'd prefer to run github-pr-check, but that is overly backed up on your personal server at this point. Is this something easily self-hosted and registered ourselves through GitHub apps?

cc @josephbergevin

gofmt support

Hi there!

It'd be great if reviewdog supported gofmt.

My case:

  1. A not formatted file main.go
$> cat main.go 
package main

import "fmt"

func main() { HelloWorld() }

func HelloWorld() {fmt.Println("hello world")}
  1. reviewdog config
$> cat reviewdog.yml                                                                                                                                                                                            
runner:
  golint:
    cmd: golint $(go list ./... | grep -v /vendor/)
    errorformat:
      - "%f:%l:%c: %m"
  gofmt:
    cmd: gofmt -l -s .|xargs -I{} echo {}:1 file {} is not gofmted
    errorformat:
      - "%f:%l %m"
  1. The diff:
$> git diff HEAD~1

diff --git a/main.go b/main.go
index fff5c2b..66228c0 100644
--- a/main.go
+++ b/main.go
@@ -2,4 +2,6 @@ package main
 
 import "fmt"
 
-func main() { fmt.Println("vim-go")}
+func main() { HelloWorld() }
+
+func HelloWorld() {fmt.Println("hello world")}
  1. The result of execution:
$> reviewdog -diff='git diff HEAD~1'
main.go:7:1: [golint] exported function HelloWorld should have comment or be unexported

AFAIU that's because of "FilteredCheck.InDiff" that remains false during the "FilterCheck" step.

How would you fix it?
I'd like to fix it myself and send PR if you don't mind.

Thanks in advance

Github check for private repo on Travis CI fails due to `403 Forbidden` error

Running the latest 0.9.9 release through the new Github app integration check. However, reviewdog fails with the following:

reviewdog: status=400: fail to parse diff: GET https://api.github.com/repos/{owner}/{repo}/pulls/123:
403 Resource not accessible by integration []

The command I'm running is:

$ ./bin/reviewdog -version
0.9.9

$ ./bin/rubocop --config .rubocop.yml --rails | ./bin/reviewdog -f=rubocop -reporter=github-pr-check
reviewdog: status=400: fail to parse diff: GET https://api.github.com/repos/{owner}/{repo}/pulls/123:
403 Resource not accessible by integration []

I've tried this both with the REVIEWDOG_TOKEN set and unset. Same error both times.

If it helps, here's what Github shows the app config as:

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.