Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate vscode and PhpStorm #108

Open
hkirsman opened this issue Aug 13, 2024 · 1 comment
Open

Integrate vscode and PhpStorm #108

hkirsman opened this issue Aug 13, 2024 · 1 comment

Comments

@hkirsman
Copy link
Collaborator

How to integrate code checks into Visual Studio Code and PhpStorm?

@hkirsman
Copy link
Collaborator Author

I initially tested with this script that we would have put under vendor/bin/:

#!/bin/bash

# Run PHP_CodeSniffer inside Docker container using the PHP 8.2 CLI image.
# The container will automatically be removed after execution (--rm).
# Mount the current working directory ($(pwd)) to the /app directory inside
# the container (-v $(pwd):/app).
# Set the working directory inside the container to /app (-w /app).
# Execute the PHP CodeSniffer command (./vendor/bin/phpcs) with the WunderAll
# standard inside the container.
# Pass any additional arguments ($*) from the script to the phpcs command.

docker run -i --rm -v $(pwd):/app -w /app php:8.2-cli ./vendor/bin/phpcs --standard=WunderAll $*

Then we can point to the script from IDE eg:
image

Result in the vscode:
image (132)

Plugin used:
https://marketplace.visualstudio.com/items?itemName=shevaua.phpcs

But why spin up yet another container, we already have Lando or DDEV running? Maybe only because we would create scanner images that we could use anywhere?

Another solution that would re-use Lando or DDEV would be to expose the phpcs (and other tools) eg lando phpcs or ddev phpcs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant