0

I have some repositories where I want to install a lint. My main concern here is that it's a lot of old code that would certainly not pass, and fixing everything is simply not a viable options. So I only want to use the lint on new code.

And I found a tool that seem to be the right choice, phpcs changed

What it does is basically to run phpcs (codesniffer) on the git diff of the files instead of the files directly.

It works perfectly locally with a command like

docker compose run --rm test ./vendor/bin/phpcs-changed --git --git-base develop src

But I'm having some troubles running them in a bitbucket pipeline. When I put the above command in a pipeline, I get the error that the current directory is not a git repository. When I use phpcs instead of phpcs-changed it does work, which makes sense.

I feel a bit lost how to proceed here. If phpcs-changed is not the right tool, I'm completely open for other options. What I want to do is simply to make the lint only act on new code.

klutt
  • 30,332
  • 17
  • 55
  • 95

0 Answers0