https://github.com/ubc/ubc-vpfo-templates-styles
https://github.com/ubc/ubc-vpfo-templates-styles
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ubc/ubc-vpfo-templates-styles
- Owner: ubc
- Created: 2024-10-31T00:13:23.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-02-03T17:49:10.000Z (5 months ago)
- Last Synced: 2025-03-06T10:32:43.246Z (4 months ago)
- Language: PHP
- Size: 12.8 MB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Using CodeSniffer to validate for WordPress Extra coding standards
1) Ensure that you have Composer installed globally and up to date
2) In the ubc-vpfo-spaces-pages project root directory, run
```composer install```
to install/update packages3) In your local ~/.zshrc file, add the following code block (if you have not already done so):
```
# CodeSniffer project alias
function set_phpcs_alias() {
if [ -f "./vendor/bin/phpcs" ]; then
alias phpcsproject='./vendor/bin/phpcs . --standard=phpcs.xml --report=full --report-file=codescan.txt'
else
unalias phpcsproject 2>/dev/null
fi
}# Run this function before each prompt
PROMPT_COMMAND="set_phpcs_alias; $PROMPT_COMMAND"# Also run it for the initial directory
set_phpcs_alias
```4) Save your ~/.zshrc file
5) run the command: ```source ~/.zshrc```
6) Quit any open terminal applications and relaunch them
7) From the ubc-vpfo-templates-styles project root directory, run the command:
```phpcsproject```
to scan your code according to WordPress Extra coding standards. The results will output to a file in the project root folder called ```codescan.txt```