Page MenuHomePhabricator

Add support for linting multiple files in script-and-regex linter
Closed, DuplicatePublic

Description

We are using script-and-regex with a wrapper script that executes gometalinter to lint our go code. The problem is that gometalinter can lint only whole directories because some go linters (like errcheck) require the whole package to be compiled. We would like script-and-regex linter to pass multiple files as a command line argument to our wrapper script so that it can deduplicate packages and lint packages at the same time itself. The practical problem we are trying to solve is that arc lint is taking too much CPU and takes too much time to complete.

Example of what is currently happening (when file1.go, file2.go and file3.go are changed):
arc lint

executes: wrapper-script.sh some/random/package/file1.go
  executes gometalinter some/random/package
executes: wrapper-script.sh some/random/package/file2.go
  executes: gometalinter some/random/package
executes: wrapper-script.sh some/random/package2/file3.go
  executes: gometalinter some/random/package2

Instead we would like arc lint to behave like this:
arc lint

executes: wrapper-script.sh some/random/package/file1.go some/random/package/file2.go some/random/package2/file3.go
  executes gometalinter some/random/package some/random/package2

One possibility of implementing this is adding an option to script-and-regex to pass all files on command line instead of just one.