AtomLinter / linter-phpcs

Linter plugin for PHP, using PHP_CodeSniffer.
63 stars 31 forks source link

Run with docker #299

Closed bertoni closed 7 years ago

bertoni commented 7 years ago

Is it possible to use it with a phpcs inside a docker container? Such as the command "docker run --rm -i image/phpcs phpcs"? I already tried, but without success...

Arcanemagus commented 7 years ago

You would have to create a wrapper script that passes on the arguments and stdin to the docker instance, this is not a supported setup directly here, but I'm sure others would be interested if you manage to get it working 😉.

bertoni commented 7 years ago

The RubberDuck always works!

I created a small script that makes a proxy to container docker:

#[phpcs.sh]
#!/bin/bash

PHPCS_BIN='docker run --rm -i -v /var/www/:/var/www abertoni/phpcs phpcs'
$PHPCS_BIN $@
exit $?

With this, enough go to the atom plugin and specify the full path of the script.

Don't forget to give permission for script: chmod a+x phpcs.sh

I hope it helps others friends!

aronwolf90 commented 5 years ago

docker exec -i <container> rubocopsolved the problem for me. with

working_dir: $PWD
volumes:
  .:$PWD

in my docker-compose.overwrite.yml