Skip to content

Commit

Permalink
Update developer documentation
Browse files Browse the repository at this point in the history
Signed-off-by: James Hunt <[email protected]>
  • Loading branch information
thetwopct committed Jun 30, 2024
1 parent 93f0ca5 commit 49cc95c
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions docs/devguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,8 @@ excludes:
services:
node:
type: 'node:14'
ssl: true
scanner: false
appserver:
run:
- /app/vendor/bin/phpcs --config-set installed_paths /app/vendor/wp-coding-standards/wpcs
- /app/vendor/bin/phpcs -i
tooling:
npm:
Expand All @@ -54,27 +51,26 @@ tooling:
service: node
npx:
service: node
phpcs:
service: appserver
cmd: /app/vendor/bin/phpcs --standard="WordPress"
description: 'Run PHPCS commands'
phpcbf:
service: appserver
cmd: /app/vendor/bin/phpcbf --standard="WordPress"
description: 'Run PHPCBF commands'
sniff:
service: appserver
cmd: /app/vendor/bin/phpcs -n -s --ignore="*/build/*,*/dist/*,*/node_modules/*,*gulpfile*,*/uploads/*,*/plugins/*,*/scripts/*,*/vendor/*,*pantheon*,*.css" -d memory_limit=1024M --standard="WordPress" /app/web/wp-content/themes/lfevents/ /app/web/wp-content/mu-plugins/custom/
description: 'Run the recommended code sniffs'
description: "Run the recommended code sniffs"
cmd: "/app/vendor/bin/phpcs -ns"
warnings:
service: appserver
description: "Show code sniff warnings"
cmd: "/app/vendor/bin/phpcs -s"
fix:
service: appserver
cmd: /app/vendor/bin/phpcbf -n -s --ignore="*/build/*,*/dist/*,*/node_modules/*,*gulpfile*,*/uploads/*,*/plugins/*,*/scripts/*,*/vendor/*,*pantheon*,*.css" -d memory_limit=1024M --standard=WordPress /app/web/wp-content/themes/lfevents/ /app/web/wp-content/mu-plugins/custom/
description: 'Run the recommended code sniffs and fix'
description: "Run the recommended code sniffs and fix them"
cmd: "/app/vendor/bin/phpcbf -s"
paths:
service: appserver
description: "See code sniff paths"
cmd: "/app/vendor/bin/phpcs -i"
debug:
service: appserver
cmd: 'touch /app/web/wp-content/debug.log && tail -f /app/web/wp-content/debug.log'
description: 'Get real-time WP debug log output'

description: "Monitor WordPress debug log output"
cmd: "tail -f /app/web/wp-content/debug.log"
```
4. Run `lando start` and note the local site URL provided at the end of the process
Expand All @@ -84,7 +80,7 @@ tooling:
6. Run `lando pull --code=none --files=none` and follow the prompts to download the media files and database from Pantheon:
* `Pull database from?` > `dev`

7. Run this script to activate a dev plugin used to load media files from the production server instead of hosting them locally, in addition to other dev plugins, and deactivates some production plugins:
7. Run this command to activate/deactivate multiple plugings that can help with local dev or are not needed for local dev. The Load Media Files from Production plugin will load media from the production server instead of needing to download them locally:

```
lando wp plugin activate debug-bar && lando wp plugin activate query-monitor && lando wp plugin deactivate shortpixel-image-optimiser && lando wp plugin deactivate pantheon-advanced-page-cache && lando wp plugin activate load-media-from-production
Expand Down Expand Up @@ -123,11 +119,17 @@ Custom plugins have their css/js compiled separately and it is stored in the rep

The CI process will sniff the code to make sure it complies with WordPress coding standards. All Linux Foundation code should comply with [these guidelines](https://docs.google.com/document/d/1TYqCwG874i6PdJDf5UX9gnCZaarvf121G1GdNH7Vl5k/edit#heading=h.dz20heii56uf).

phpcs and the [WordPress Coding Standards for PHP_CodeSniffer](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards) come as part of the Lando install and are installed in the vendor directory by composer. phpcs can be run on the command line using `lando phpcs` and phpcbf using `lando phpcbf`. Both commands are setup to use WordPress Coding Standards and to run on the `wp-content/themes/` directory.
phpcs and the [WordPress Coding Standards for PHP_CodeSniffer](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards) come as part of the Lando install and are installed in the vendor directory by Composer.

You can get a report of required fixes on your code by running `lando sniff` and you can automatically fix some required changes by running `lando fix`. You can see warnings by running `lando warnings`.

Both commands are setup to use WordPress Coding Standards and to run on the `wp-content/themes/` directory as well as on custom plugins. This is controlled by the phpcs.xml file.

If you want to run your own phpcs/cbf commands, this can be done within Lando using `lando php ./vendor/bin/phpcs ?` where `?` is your arguments to pass.

It's even more convenient to [install into your text editor](https://github.com/WordPress/WordPress-Coding-Standards/wiki).
It's even more convenient to [install into your IDE](https://github.com/WordPress/WordPress-Coding-Standards/wiki).

Since the lfeventsci repo includes phpcs via composer, your text editor should use that version of the binary even though you may have phpcs installed system-wide.
Since the lfeventsci repo includes phpcs via Composer, your IDE should use that version of the binary even though you may have phpcs installed system-wide.

-----

Expand Down

0 comments on commit 49cc95c

Please sign in to comment.