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