sirbrillig / phpcs-changed

🐘 Run phpcs on files and only report new warnings/errors compared to the previous version.
MIT License
31 stars 11 forks source link

Feature request: accommodate CI support #25

Closed david-binda closed 4 years ago

david-binda commented 4 years ago

The phpcs-changed's git support works really well when it comes to linting work in progress, however I struggled with making it work in CI, travis specifically.

The issue with travis is that it leaves the working directory in clean state after checkout.

Travis CI branch build:

$ git clone --depth=50 --branch=test/travis https://github.com/david-binda/liveblog.git david-binda/liveblog
$ cd david-binda/liveblog
$ git checkout -qf 16b11e099940ea65e233ec6be6256ddf9588c3ea
$ git status
HEAD detached at 16b11e0
nothing to commit, working directory clean

Travis CI Pull Request build:

$ git clone --depth=50 https://github.com/david-binda/liveblog.git david-binda/liveblog
$ cd david-binda/liveblog
$ git fetch origin +refs/pull/3/merge:
$ git checkout -qf FETCH_HEAD
$ git status
HEAD detached at FETCH_HEAD
nothing to commit, working directory clean

As the working directory, in both cases, is clean, we can't use either of the the git modes (stashed/unstashed) currently supported by phpcs-changed.

From my point of view, a support for making the phpcs-changed to work on diffs across git branches might be enough to accommodate the needs of Travis / CI intergrations.

I believe that adding a param which would indicate against which branch the diff of current copy of a file should be taken would be enough for making the travis work in both cases.

sirbrillig commented 4 years ago

I think this was fixed by #28