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

The Biggest WP Core Patch Ever

The Biggest WP Core Patch Ever

Presented on September 30, 2017 at the unconference of the PHP North West Conference, Manchester, United Kingdom.
http://conference.phpnw.org.uk/phpnw17/
---------------------------------------------------------------
If you’re looking at the WordPress core code, you wouldn’t easily believe that WordPress actually has clear and consistent coding standards.
While the standards are in the Core developers handbook, most of the WordPress code base does not comply and patches to fix this were not being accepted.

Until now.

So let me tell you a little story about how we created the biggest patch to go into WordPress core ever. …

2776198ea9584b6c0d4b494293b8d635?s=128

Juliette Reinders Folmer

September 30, 2017
Tweet

Transcript

  1. The Biggest WordPress Core Patch Ever * Juliette Reinders Folmer

    * Probably ajavargas
  2. None
  3. Coding Standards Compliance https://core.trac.wordpress.org/ticket/41057

  4. Why is Code Style Important ? Easier to maintain &

    debug Easier to start contributing Easier to comprehend
  5. Evolution of the WordPress Code Base 0 50 100 150

    200 250 300 350 400 25-7-2012 1-7-2013 1-7-2014 1-7-2015 1-7-2016 1-7-2017 x 1.000 Lines of Code (ex comments) Clean Code
  6. None
  7. None
  8. Tooling  https://github.com/squizlabs/PHP_CodeSniffer  https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards PHP CodeSniffer by WordPress Coding

    Standards for PHPCS
  9. Tooling PHP CodeSniffer WordPress Coding Standards phpcs phpcbf rulesets sniffs

    checks + fixers
  10. Code Style Error Prevention Documentation Bug Prevention Best Practices Type

    of Sniffs
  11. 57 SNIFFS in the WordPress Core ruleset

  12. 67.957 errors 83.771 auto-fixable 20.997 warnings in 1178 files

  13. 189 Unique Error Codes Top 10 Error Sources: 1. PEAR.Functions.FunctionCallSignature

    2. WordPress.Arrays.MultipleStatement Alignment 3. Generic.ControlStructures.InlineControl Structure 4. Generic.WhiteSpace.ScopeIndent 5. WordPress.Arrays.ArrayDeclarationSpacing 6. WordPress.WhiteSpace.OperatorSpacing 7. WordPress.Arrays.ArrayKeySpacing Restrictions 8. WordPress.Arrays.CommaAfterArrayItem 9. Squiz.Strings.DoubleQuoteUsage 10.WordPress.Arrays.ArrayIndentation
  14. Here Be Dragons Fixer Conflicts Badly set up Sniffs Bugs

    in Sniffs and Fixers Missing Sniffs
  15. Wins  More comprehensive WP Coding Standards  Better sniffs

    in both WPCS + PHPCS  Better code Steven Lilley
  16. The Biggest WordPress Core Patch Ever ?

  17. +101,615* -73,373* 93.036 fixes in 1,121 files * Estimates based

    on current status of the ticket
  18. > 25 % of all lines of codes changed ozgary

  19. The Team Stephen Edgar Gary Pendergast Juliette Reinders Folmer Weston

    Ruter J.D. Grimes Gary Jones Core Team WPCS team Maybe you ?
  20. Thanks! Any questions ? Slides: https://speakerdeck.com/jrf Feedback: https://joind.in/talk/dafa1 @jrf_nl @jrfnl

    @jrf