1 of 16

WordPress

Coding Standards

Micah Wood

@wpscholar

wpscholar.com

link.wpscholar.com/wcavl-2019-standards

2 of 16

What are they?

3 of 16

Coding Conventions

General guidelines recognized by most developers and tend to result in higher quality software.

4 of 16

Coding Standards

Coding conventions that have been formally adopted by a team or organization.

5 of 16

They aren’t one-size-fits-all.

6 of 16

Standards

can change.

7 of 16

Why use them?

8 of 16

Easy to add, maintain and debug code.

9 of 16

Benefits of Standards

  • Code is more consistent
  • Code is easier to read
  • Code collaboration is easier
  • Code is more secure
  • Code is more performant
  • Code is simpler
  • Code is easier to understand
  • Technical debt is reduced
  • Code is easier to maintain
  • Costs are reduced
  • Code life is extended
  • Sense of pride is high

10 of 16

Coding standards are a good code mentor.

11 of 16

How do I use them?

12 of 16

Install Composer

getcomposer.org

13 of 16

Install Coding Standards�composer require wpscholar/phpcs-standards-wpscholar

14 of 16

Run PHP Code Sniffer�vendor/bin/phpcs . --standard=WPScholar

15 of 16

Add a Composer Script

16 of 16

Resources