You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18-6
Original file line number
Diff line number
Diff line change
@@ -127,14 +127,25 @@ Also, if you want to use the asset server finely, you have to add the assets con
127
127
`json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'`. In fact the npm command will build asset in memory only, and modify the manifest file to map asset to a new url served by the asset server instead of the main web server.
128
128
129
129
# code quality
130
+
## PHP
131
+
The project uses 2 packages to lint and fix the code style of PHP code :You can install phpcs to check your code
132
+
* squizlabs/PHP_CodeSniffer to lint and follow PSR1/PSR2 rules.
133
+
* friendsofphp/php-cs-fixer to fix the code
134
+
135
+
Lint with this command `vendor/bin/phpcs src -n --standard=PSR1,PSR2 --report=summary` to get a summary of errors.
136
+
Fix with this command `vendor/bin/php-cs-fixer fix src --rules=@PSR1,@PSR2`
137
+
138
+
## Javascript
139
+
For Javascript the following packages has been used:
140
+
`npm install prettier`
141
+
142
+
To lint the code: `node bin-prettier.js assets/js/**`
143
+
To fix it: `node bin-prettier.js assets/js/** --write`
130
144
131
-
You can install phpcs to check your code, for this run `composer require squizlabs/PHP_CodeSniffer`. This project follows
132
-
PSR1/PSR2 rules. Run this command `vendor/bin/phpcs src -n --standard=PSR1,PSR2 --report=summary` to get a summary of
133
-
errors
145
+
## IDE
134
146
135
-
For PHP you should configure your IDE to follow Symfony code style (or anything else if you prefer) for PHP, and Airbnb or any other check style for Javascript.
136
-
You can use `friendsofphp/php-cs-fixer` package to fix your PHP code and `prettier`for Javascript.
137
-
We may add those packages to the current stack if it's something requested.
147
+
For PHP you should configure your IDE to follow PSR1/PSR2 code style (or anything else if you prefer). For JS you will
148
+
have to install [prettier tool](https://prettier.io/docs/en/editors.html).
138
149
139
150
## todo
140
151
@@ -143,3 +154,4 @@ We may add those packages to the current stack if it's something requested.
143
154
*~~add db fixtures at init ! almost 40 books and some reviews (at least 3 for 5 1st books)~~ all sqlite fixtures is converted into the final db model
144
155
* customize easyAdminBundle to add author/editor from Book and display those related infos on Book admin page (same for other author/editor entities and serie/reviews)
145
156
* manage Entity orphanRemoval / CASCADE onDelete
157
+
* find a good way to add a `pre-commit` hook that lint PHP and JS code, and run the PHP / JS tests
0 commit comments