How to use phpcs from docker-compose?
See original GitHub issueI use wodby/drupal-php (docker4drupal), which have inside a phpcs
docker-compose exec php phpcs --version
PHP_CodeSniffer version 3.3.2 (stable) by Squiz (http://www.squiz.net)
Can I use this in vscode?
I trying create exec file phpcs-vscobe
#!/bin/sh
docker-compose exec php phpcs "$@"
and have an error from phpcs-vscode:
the input device is not a TTY
I added to file export COMPOSE_INTERACTIVE_NO_CLI=1
and error changed to
phpcs: Unable to locate phpcs. Command failed: “/home/alexey/phpcs-vscode” --version Traceback (most recent call last): File “/usr/lib/python3.7/site-packages/dockerpty/pty.py”, line 334, in start self._hijack_tty(pumps) File “/usr/lib/python3.7/site-packages/dockerpty/pty.py”, line 367, in _hijack_tty read_ready, write_ready = io.select(read_pumps, write_streams, timeout=60) File “/usr/lib/python3.7/site-packages/dockerpty/io.py”, line 59, in select timeout, File “/usr/lib/python3.7/site-packages/dockerpty/io.py”, line 351, in fileno return self.from_stream.fileno() File “/usr/lib/python3.7/site-packages/dockerpty/io.py”, line 103, in fileno return self.fd.fileno() File “/usr/lib/python3.7/socket.py”, line 638, in fileno self._checkClosed() ValueError: I/O operation on closed file. During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/usr/bin/docker-compose”, line 11, in <module> load_entry_point(‘docker-compose==1.23.2’, ‘console_scripts’, ‘docker-compose’)() File “/usr/lib/python3.7/site-packages/compose/cli/main.py”, line 71, in main command() File “/usr/lib/python3.7/site-packages/compose/cli/main.py”, line 127, in perform_command handler(command, command_options) File “/usr/lib/python3.7/site-packages/compose/cli/main.py”, line 535, in exec_command pty.start() File “/usr/lib/python3.7/site-packages/dockerpty/pty.py”, line 338, in start io.set_blocking(pump, flag) File “/usr/lib/python3.7/site-packages/dockerpty/io.py”, line 32, in set_blocking old_flag = fcntl.fcntl(fd, fcntl.F_GETFL) File “/usr/lib/python3.7/site-packages/dockerpty/io.py”, line 351, in fileno return self.from_stream.fileno() File “/usr/lib/python3.7/site-packages/dockerpty/io.py”, line 103, in fileno return self.fd.fileno() File “/usr/lib/python3.7/socket.py”, line 638, in fileno self._checkClosed() ValueError: I/O operation on closed file.
I don`t known that I can try else. I whuld be happy if we could solve this situation. 😃
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:6
I tried same setup and the current result is a less verbose error, “phpcs: Cannot read property ‘toString’ of null”
The closest I could get was to create an executable bash wrapper at
/usr/local/bin/phpcs
with the following:Then I’m able to run phpcs from the VSCode terminal. I still can’t get the GUI to recognize issues, however. I see the spinning loading icon that phpcs is attempting to parse the current PHP file as I edit it.
OS: Ubuntu 19.04 Docker version 19.03.0-beta5, build 4a18bf4