1
0
Fork 0
mirror of synced 2024-06-27 18:50:47 +12:00

feat: composer scripts

This commit is contained in:
Torsten Dittmann 2022-07-08 17:17:20 +02:00
parent 6d85772bd1
commit 0c46022f1b
2 changed files with 12 additions and 7 deletions

View file

@ -51,19 +51,19 @@ $ git checkout -b [name_of_your_new_branch]
4. Before you push your changes, make sure your code follows the `PSR12` coding standards , which is the standard Appwrite follows currently. You can easily do this by running the formatter. 4. Before you push your changes, make sure your code follows the `PSR12` coding standards , which is the standard Appwrite follows currently. You can easily do this by running the formatter.
```bash ```bash
./vendor/bin/phpcbf <your file path> composer format <your file path>
``` ```
Now, go a step further by running the linter by the following command to manually fix the issues the formatter wasn't able to fix. Now, go a step further by running the linter by the following command to manually fix the issues the formatter wasn't able to fix.
```bash ```bash
./vendor/bin/phpcs <your file path> composer lint <your file path>
``` ```
This will give you a list of errors for you to rectify , if there is an instance you need more information on the errors being displayed you can pass in additional command line arguments. More list of available arguments can be found [here](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage). A very useful command line argument is `--report=diff`. This will give you the expected changes by the linter for easy fixing of formatting issues. This will give you a list of errors for you to rectify , if there is an instance you need more information on the errors being displayed you can pass in additional command line arguments. More list of available arguments can be found [here](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage). A very useful command line argument is `--report=diff`. This will give you the expected changes by the linter for easy fixing of formatting issues.
```bash ```bash
./vendor/bin/phpcs --report=diff <your file path> composer lint --report=diff <your file path>
``` ```
5. Push changes to GitHub 5. Push changes to GitHub
@ -413,18 +413,18 @@ We use some automation tools to help us keep a healthy codebase.
```bash ```bash
# Run on all files # Run on all files
./vendor/bin/phpcbf composer format
# Run on single file or folder # Run on single file or folder
./vendor/bin/phpcbf <your file path> composer format <your file path>
``` ```
**Run Linter:** **Run Linter:**
```bash ```bash
# Run on all files # Run on all files
./vendor/bin/phpcs composer lint
# Run on single file or folder # Run on single file or folder
./vendor/bin/phpcs <your file path> composer lint <your file path>
``` ```
## Tutorials ## Tutorials

View file

@ -9,6 +9,11 @@
"email": "eldad@appwrite.io" "email": "eldad@appwrite.io"
} }
], ],
"scripts": {
"test": "vendor/bin/phpunit",
"lint": "vendor/bin/phpcs",
"format": "vendor/bin/phpcbf"
},
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Appwrite\\": "src/Appwrite", "Appwrite\\": "src/Appwrite",