-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Draft of first Part of the IDE Guide
- Loading branch information
1 parent
3cefb86
commit 1c4e511
Showing
11 changed files
with
119 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,6 @@ indent_size = 4 | |
[*.{yml,yaml,neon}] | ||
indent_size = 2 | ||
|
||
[*.md] | ||
max_line_length = 80 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# How to use the Coding-Standard in PHPStorm | ||
|
||
## Introduction | ||
|
||
The Coding-Standard application is designed as an integrated application to make | ||
sure it has as few dependencies as possible. As a result, it is less obvious how | ||
to use the IDE with the project. This document will guide you through the steps | ||
necessary to get code highlighting and auto-fixing working in your IDE. | ||
|
||
The Coding-Standard incorporates different tools to check and fix your code. | ||
Here are the guides to set up PHPStorm for each tool: | ||
|
||
- [PHP Code Sniffer](PhpCS/php-code-sniffer.md) | ||
|
||
|
||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Set up PHPStorm for PHP CodeSniffer | ||
|
||
This guide will help you set up PHPStorm to use PHP CodeSniffer. You will be | ||
able to see code highlighting and use auto-fixing in your IDE. | ||
|
||
How long will it take: xx minutes | ||
|
||
Pre-requisites: | ||
- Completed guide: [PHP-Interpreter](../PhpInterpreter/PhpInterpreter.md) | ||
- A local composer project, fully installed | ||
|
||
## Steps | ||
|
||
1) Open the PHPStorm IDE and load up the project you want to work on. | ||
2) Open the settings dialog by pressing `Ctrl + Alt + S`(Windows + Linux) | ||
`CMD + ,` (macOS). | ||
3) Navigate to "PHP" -> "Quality Tools" -> "PHP CodeSniffer" and open the | ||
Configuration by clicking on the "..." button. | ||
![PHP CodeSniffer](php-code-sniffer.png) | ||
4) If your [PHP interpreter](#Set-up-the-PHP-interpreter) we just set up in the | ||
last step is not automatically added to the list click on the "+" button to | ||
add it now. | ||
5) Fill the Dialog as follows | ||
* `PHP_CodeSniffer path` must be `/coding-standard/vendor/bin/phpcs` | ||
* `Path to phpcbf` must be `/coding-standard/vendor/bin/phpcbf` | ||
|
||
![PHP CodeSniffer ConfiguratZion](php-code-sniffer-configuration.png) | ||
6) Click on the Folder Icon in `Docker container` and change the Volume bindings | ||
as follows. The only entry allowed here is Hostpath = absolute Path to your | ||
project -> Container path = /app | ||
|
||
![PHP CodeSniffer Configuration](php-code-sniffer-configuration-docker.png) | ||
7) Return to "PHP" -> "Quality Tools" -> "PHP_CodeSniffer". | ||
8) Choose your newly added configuration and Switch it on. | ||
9) Now we have to do something wierd. Close the settings dialog. Navigate to a | ||
PHP file and do any change. Any change will do. Just add a space. | ||
10) Return to the settings dialog by pressing `Ctrl + Alt + S`(Windows + Linux) | ||
`CMD + ,` (macOS). | ||
11) Navigate to "PHP" -> "Quality Tools" -> "PHP CodeSniffer" and | ||
choose `ZooRoyal` as Coding standard. | ||
12) Close dialog. You are done. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Set up the PHP interpreter | ||
|
||
|
||
## Docker | ||
|
||
This guide will show you how to install the PHP-Interpreter you need to execute | ||
the coding-standard application. | ||
|
||
How long will it take: 5 minutes | ||
|
||
## Steps | ||
|
||
1) Open the PHPStorm IDE and load up the project you want to work on. | ||
2) Open the settings dialog by pressing `Ctrl + Alt + S`(Windows + Linux) | ||
`CMD + ,` (macOS). | ||
3) Remember what interpreter you are using right now | ||
4) Navigate to "PHP" and open the interpreter settings by clicking on the | ||
"..." button next to the interpreter dropdown. | ||
![PHP Settings](php-settings.png) | ||
5) Click on the "+" button to add a new interpreter. | ||
Choose `From Docker`. In the following dialog choose `Docker` and use the image | ||
`ghcr.io/zooroyal/coding-standard-source:latest`. Check that all settings are | ||
equal to the image linked below. | ||
![PHP Interpreter](php-settings-interpreter.png) | ||
6) Make sure you don't forget to tick `Visible for all projects`. | ||
7) Close this dialog. | ||
8) Do not choose this interpreter as default CLI Interpreter. Use what you saw in step 2). | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Setup coding-standard-source | ||
|
||
We need to make sure the coding-standard-source is installed and available | ||
in your environment. | ||
|
||
1) Clone the coding-standard-source repository | ||
```bash | ||
git clone git@github.com:ZooRoyal/coding-standard-source.git | ||
``` | ||
2) Install the dependencies | ||
```bash | ||
composer install | ||
``` | ||
Notice how npm dependencies are also installed. This is because of a | ||
custom script in the composer.json file. ("post-install-cmd") | ||
|
||
#### Optional | ||
|
||
Check if everything works by running the coding-standard from source. For | ||
this your need to switch to a git repository on your disc containing a composer. | ||
json file and execute a test run. | ||
|
||
```bash | ||
cd /path/to/your/project | ||
/path/to/coding-standard-source/tests/run-coding-standard.sh sca:all | ||
``` | ||
The script understands the same parameters as the coding-standard | ||
application. As it will build the coding-standard application from source it | ||
will take a little longer then a normal run. |