Coder Presentation Boston


Published on

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Coder Presentation Boston

  1. 1. Boston DrupalCon A Developer's Assistant: Using Coder for Module Developers & Maintainers By Doug Green [email_address] [email_address]
  2. 2. A Developer's Assistant <ul><li>Coder Module Overview </li></ul><ul><li>History </li></ul><ul><li>Developer Module, built for you (and me) </li></ul><ul><li>What does it do? </li></ul><ul><li>Credit </li></ul><ul><li>Credit contributors: snpower, webchick, nancyw </li></ul>
  3. 3. <ul><li>Style Review </li></ul><ul><li>Comment Review </li></ul><ul><li>SQL Review </li></ul><ul><li>Upgrade Reviews (4.7.x, 5.x, 6.x) </li></ul><ul><li>Security & Performance Reviews </li></ul><ul><li>What is a Review? </li></ul>A Developer's Assistant
  4. 4. <ul><li>spaces, tabs, indentation </li></ul><ul><li>string concatenation </li></ul><ul><li>global variable names, camelCase </li></ul><ul><li>positioning of curly { } </li></ul><ul><li>... and more ... </li></ul><ul><li>What does the style review check? </li></ul><ul><li>See </li></ul>A Developer's Assistant
  5. 5. <ul><li>spacings and indentation within comments </li></ul><ul><li>$Id$ </li></ul><ul><li>several uses of @see </li></ul><ul><li>What does the comment review check? </li></ul><ul><li>See </li></ul>A Developer's Assistant
  6. 6. <ul><li>capitalization of SQL keywords </li></ul><ul><li>brackets around {table} </li></ul><ul><li>SQL LIMIT instead of db_query_range() </li></ul><ul><li>What does the SQL review check? </li></ul>A Developer's Assistant
  7. 7. <ul><li>FAPI </li></ul><ul><li>Menu </li></ul><ul><li>Schema API </li></ul><ul><li>Info File changes </li></ul><ul><li>... much much more ... </li></ul><ul><li>What does the upgrade review check? </li></ul><ul><li>See </li></ul>A Developer's Assistant
  8. 8. <ul><li>not enough, difficult problem </li></ul><ul><li>SQL injection through variables </li></ul><ul><li>REQUEST_URI instead of request_url() </li></ul><ul><li>What does the security review check? </li></ul><ul><li>See </li></ul>A Developer's Assistant
  9. 9. <ul><li>Download from project page, install, and enable </li></ul><ul><li>Setup defaults on admin/settings/coder </li></ul><ul><li>http://localhost/coder - selection form </li></ul><ul><li>http://localhost/coder/defaults </li></ul><ul><li>http://localhostcoder/core - all of core </li></ul><ul><li>$ drush coder ... </li></ul><ul><li>How do I Use Coder? </li></ul>A Developer's Assistant
  10. 10. <ul><li>Selection Form / Settings Form </li></ul>A Developer's Assistant
  11. 11. <ul><li>What To Review </li></ul>A Developer's Assistant
  12. 12. <ul><li>Run from Drupal 5 </li></ul><ul><li>Run from Drupal 6 (recommended) </li></ul><ul><li>Catches Quite a Bit... </li></ul><ul><li>But it's just a tool that makes suggestions </li></ul><ul><li>You are Smarter than Coder </li></ul><ul><li>Drupal 5.x -> 6.x Upgrade Review </li></ul>A Developer's Assistant
  13. 13. <ul><li>drush coder </li></ul><ul><li>drush coder style </li></ul><ul><li>drush coder panels </li></ul><ul><li>drush coder core </li></ul><ul><li>drush coder all </li></ul><ul><li>drush coder no-coder </li></ul><ul><li>Drush – Drupal Shell </li></ul>A Developer's Assistant
  14. 14. <ul><li>cvs co DRUPAL-5—2 + DRUPAL-5 branches </li></ul><ul><li>1,843 modules </li></ul><ul><li>5,191 files </li></ul><ul><li>265 critical errors </li></ul><ul><li>35,950 warnings </li></ul><ul><li>109,000 minor warnings </li></ul><ul><li>Coder Style Review of all of Drupal </li></ul>A Developer's Assistant
  15. 15. <ul><li>1. Use an indent of 2 spaces, with no tabs </li></ul><ul><li>2. missing spaces </li></ul><ul><li>3. extra trailing spaces </li></ul><ul><li>4. string concatenation </li></ul><ul><li>5. curly braces { should end a line, not start one </li></ul><ul><li>6. camelCase </li></ul><ul><li>7. indent secondary line of comment one space </li></ul><ul><li>Most Common Errors </li></ul>A Developer's Assistant
  16. 16. ββ if (!$table) { βββββ $as .= '_orderby'; βββββ $alias = $field; ββ } should be ββ if (!$table) { ββββ $as .= '_orderby'; ββββ $alias = $field; ββ } <ul><li>111,153 warnings... views.module, line 66, 67 </li></ul><ul><li>1. Use an indent of 2 spaces with no tabs </li></ul>A Developer's Assistant
  17. 17. if(!isset ($node)){ $node=array('status' => 1); } should be if (!isset($node)) { $node = array('status' => 1); } <ul><li>35,262 warnings </li></ul><ul><li>2. missing spaces </li></ul>A Developer's Assistant
  18. 18. /** β * Output a confirmation form β * β * β This function returns a complete form for confirming an action. A link is β * β offered to go back to the item that is being changed in case the user β β * β changes his/her mind. β * <ul><li>29,205, system.module +2126 </li></ul><ul><li>3. extra trailing spaces </li></ul>A Developer's Assistant
  19. 19. '#title' => $module . ' module', should be '#title' => $module .' module', <ul><li>23,679, update.php +359 </li></ul><ul><li>4. string concatenation </li></ul>A Developer's Assistant
  20. 20. '#title' => $module . ' module', should be '#title' => $module .' module', <ul><li>13,712 </li></ul><ul><li>5. curly braces { should end a line, not start one </li></ul>A Developer's Assistant
  21. 21. $testBucket = variable_get('mm_s3_bucket', ... should be $test_bucket = variable_get('mm_s3_bucket', ... <ul><li>11,126, stdClass is an exception </li></ul><ul><li>6. camelCase </li></ul>A Developer's Assistant
  22. 22. /** * Format a password field. */ should be /** * Format a password field. */ <ul><li>6,281, +1604 </li></ul><ul><li>7. indent 2 nd line of comment one space </li></ul>A Developer's Assistant
  23. 23. <ul><li>show review of views from the browser </li></ul><ul><li>show from drush </li></ul><ul><li>demo 1.x upgraded to Drupal 6.x </li></ul><ul><li>6.x upgrade review </li></ul>A Developer's Assistant
  24. 24. <ul><li>7.x upgrade review </li></ul><ul><li>Continue to improve security review </li></ul><ul><li>Create patch files – somewhat possible </li></ul><ul><li>Parse & code flow analysis – probably not </li></ul><ul><li>The Future of Coder </li></ul>A Developer's Assistant
  25. 25. [email_address] A Developer's Assistant