From 0c46022f1b67ce980f16ccb11582ce6cc692312a Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Fri, 8 Jul 2022 17:17:20 +0200 Subject: [PATCH] feat: composer scripts --- CONTRIBUTING.md | 14 +++++++------- composer.json | 5 +++++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 255595c59..0a0cf85c1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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. ```bash -./vendor/bin/phpcbf +composer format ``` 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 -./vendor/bin/phpcs +composer lint ``` 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 -./vendor/bin/phpcs --report=diff +composer lint --report=diff ``` 5. Push changes to GitHub @@ -413,18 +413,18 @@ We use some automation tools to help us keep a healthy codebase. ```bash # Run on all files -./vendor/bin/phpcbf +composer format # Run on single file or folder -./vendor/bin/phpcbf +composer format ``` **Run Linter:** ```bash # Run on all files -./vendor/bin/phpcs +composer lint # Run on single file or folder -./vendor/bin/phpcs +composer lint ``` ## Tutorials diff --git a/composer.json b/composer.json index ded0834bb..1cc1385c1 100644 --- a/composer.json +++ b/composer.json @@ -9,6 +9,11 @@ "email": "eldad@appwrite.io" } ], + "scripts": { + "test": "vendor/bin/phpunit", + "lint": "vendor/bin/phpcs", + "format": "vendor/bin/phpcbf" + }, "autoload": { "psr-4": { "Appwrite\\": "src/Appwrite",