Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How to Write Better Code Automatically

Kaspars
November 25, 2017

How to Write Better Code Automatically

An overview of tools and processes that help you write better code for WordPress or any other PHP application.

Presented at WordCamp Rīga 2017 (November 25).

Kaspars

November 25, 2017
Tweet

More Decks by Kaspars

Other Decks in Programming

Transcript

  1. Use Computers to… Is this supported in PHP 5.3 and

    PHP 7.2? Does it work with WordPress 5.0 and Jetpack 5.0? Does the JS & CSS work in IE 8? Does it impact the page load time?
  2. –User Support Request “All images are broken in the latest

    version of the plugin! Fix it ASAP!111” Use Version Control
  3. Use Git Hooks BONUS $ git commit -m "Fix user

    not found" PHP Parse error: syntax error, unexpected '}', expecting ';' in modules/custom-post-types- taxonomies/module.php on line 27 Errors parsing modules/custom-post-types- taxonomies/module.php
  4. Use Coding Standards Developers Who Use Spaces Make More Money

    Than Those Who Use Tabs https://stackoverflow.blog/2017/06/15/developers-use-spaces-make-money-use-tabs/
  5. Use Coding Standards • Tabs or spaces for indentation? •

    Single or double quotes? • Closing PHP tags? • Braces or no braces for one-line conditionals?
  6. Use a Virtual Environment Varying Vagrant Vagrants (VVV) https://varyingvagrantvagrants.org Good

    for WP core development Can’t run two boxes at the same time
  7. Use a good text editor Use Git for version control

    and hooks Use a package manager Use GitHub for continuous integration and accepting contributions Use code linters (checkers) Use coding standards Use automated testing Use virtual development environment