Project Coding Standards
Communications
- Must use Git and Beanstalk for documenting changes.
- Basecamp will be used for documenting communication between developers, project manager etc. Slack/Skype may be used day-to-day but these tools do not provide adequate long-term records so be sure decisions etc are documented in Basecamp.
- Any emails sent to clients should also be added to the appropriate Basecamp ticket
Development Process
- Repository should contain source files (eg LESS files) and also deliverables (eg CSS, minified output).
- Do not source control WordPress core files or non-required themes (eg TwentyFifteen)
- Do not source control plugins
- Use git flow for building & tagging releases – see git flow cheatsheet: https://danielkummer.github.io/git-flow-cheatsheet/
- Releases should be numbered with semantic versioning (eg 1.0.0)
- For ease of reference, feature branches should be named/numbered to match the corresponding Basecamp ticket – eg feature/1.8-increase-button-font-size
- All changes are pushed to the staging site setup on WP Engine for review before releasing to live – merge the feature branch into our staging branch
- Code must pass code review before being released to the live site
Coding Standards
- Use png for graphic assets and jpg for images
- We prefer that you use a CSS preprocessor, LESS or SASS, during development. If working on a project that already uses LESS/SASS then any styling changes should follow that standard
- Use CSS vendor prefixes where necessary – you should configure your preprocessor to generate these automatically depending on the browser versions targeted. Refer to http://caniuse.com for browser support
- Use CSS styles and live text whenever possible when building the site (eg buttons). Only use images when absolutely necessary.
- The HTML should validate (http://validator.w3.org/) if possible. Validation errors from JavaScript or WordPress plugins may be acceptable.
- PHP, Javascript, CSS and HTML must follow the appropriate WordPress Coding Standards:
- PHP: https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/
- JS: https://make.wordpress.org/core/handbook/best-practices/coding-standards/javascript/
- CSS: https://make.wordpress.org/core/handbook/best-practices/coding-standards/css/
- HTML: https://make.wordpress.org/core/handbook/best-practices/coding-standards/html/
- Ensure all code is tested cross-browser and across all window widths – pay special attention at and either side of popular mobile device widths (eg 320px, 768px, 1024px, 1200px)
- Bugs: VE developers will fix bugs up to 30 days from the date of deployment of the last task in the SOW.
- Copy: all copy must be supplied before development begins, or VE dev can use filler copy.
- If using code from other sources, developers may only use code which is Public Domain or covered by a compatible Open Source license and must add a comment to credit back to the original source (eg Stack Exchange, wordpress.org, developers’ websites). No code may be used that is covered by Intellectual Property Rights (eg code written for other clients, code copied from sources that are not Open Source)
Tools
You are free to use any development tools you wish. However existing developers have found the following helpful:
- Git: Gitkraken https://www.gitkraken.com/
- Editing: Atom https://atom.io/
- Coding standards: PHPCS https://github.com/squizlabs/PHP_CodeSniffer
- WordPress rules for PHPCS: https://github.com/WordPress/WordPress-Coding-Standards