Skip to content

Commit 6ac3b1b

Browse files
committed
#108 Update readme for IDE integration.
1 parent 5c82c23 commit 6ac3b1b

File tree

2 files changed

+42
-21
lines changed

2 files changed

+42
-21
lines changed

README.md

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,52 @@ You can easily use the code quality checkers on your CI (CircleCi/Jenkins/GitLab
107107
./vendor/bin/grumphp run --no-ansi --no-interaction
108108
```
109109

110-
## IDE Integration
110+
## IDE Integration (optional)
111111

112-
To use PHPCS from your IDE, you can point it to the following script:
112+
### Prerequisites
113113

114+
#### Ubuntu
115+
To install the necessary PHP components without Apache:
114116
```
115-
vendor/wunderio/code-quality/bin/phpcs-docker
117+
sudo apt install php-cli php-tokenizer
116118
```
117119

118-
This script runs PHP_CodeSniffer inside a Docker container using the PHP 8.2
119-
CLI image. It mounts the current working directory to the /app directory inside
120-
the container and executes the PHPCS command with the WunderAll standard.
120+
#### macOS
121+
[Placeholder for macOS installation instructions]
121122

122-
For Visual Studio Code you'd also need this plugin
123-
https://marketplace.visualstudio.com/items?itemName=shevaua.phpcs
123+
### Configuration
124+
125+
#### Visual Studio Code
126+
127+
1. Install the [Drupal extension](https://marketplace.visualstudio.com/items?itemName=Stanislav.vscode-drupal).
128+
2. Open the Drupal extension configuration.
129+
3. Find "Drupal > Phpcs: Args" and "Drupal > Phpcbf: Args".
130+
4. Click "Edit in settings.json" and add:
131+
132+
```json
133+
{
134+
"drupal.phpcs.args": [
135+
"--standard=WunderAll"
136+
],
137+
"drupal.phpcbf.args": [
138+
"--standard=WunderAll"
139+
]
140+
}
141+
```
142+
143+
PHPCS usage Example in Visual Studio Code:
144+
![PHPCS Usage Example in VSC](https://user-images.githubusercontent.com/11972062/221161739-cabcd4b5-800d-4d5b-8071-9324bf2bcc08.gif)
145+
146+
#### PhpStorm
147+
148+
Open settings and look for PHP_Codesniffer. Make sure these settings are the same:
149+
![PhpStorm settings PHPCS 1/2](https://www.upload.ee/image/16969201/2024-08-14_15-59.png)
150+
151+
Check the paths and validate:
152+
![PhpStorm settings PHPCS 2/2](https://www.upload.ee/image/16969203/2024-08-14_16-01.png)
153+
154+
Warnings are underlined and you can choose to fix them by right clicking:
155+
![How to fix 1/2](https://www.upload.ee/image/16969207/2024-08-14_16-03.png)
124156

157+
Choose the "PHP Code Beautifier and Fixer: fix the whole file"
158+
![How to fix 2/2](https://www.upload.ee/image/16969210/2024-08-14_16-04.png)

bin/phpcs-docker

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)