Difference between revisions of "Programming Guideline Checklist"
From Dreamwidth Notes
Foxfirefey (Talk | contribs) (Created page with 'This is a quick checklist of the Dev Programming Guidelines page; go there for details. == Code Formatting == * Check for whitespace: ** Four spaces for indentation. No ta...') |
(No difference)
|
Revision as of 07:14, 25 March 2009
This is a quick checklist of the Dev Programming Guidelines page; go there for details.
Code Formatting
- Check for whitespace:
- Four spaces for indentation. No tabs.
- No trailing whitespace.
- Spaces around parenthesis and operators. A space between if and the starting parens, spaces between method arg parens, etc. Do not use spaces around hash indexes, however.
- Suggested line break length at 120 characters.
- Do not use extraneous parentheses, including on methods that don't need it or on postfix conditionals.
- Use postfix conditionals -- ie, do_something() if $something;
- Use human logic -- unless instead of if not.
- Don't quote hash literals -- $HASH{DATA}, not $HASH{'DATA'}
- Commenting: have you commented appropriately?
DW Code Specific Conventions
- Use LJ::HOME over $ENV{LJHOME}
- Use LJ::is_enabled() over $LJ::DISABLED
- Use $u->get_cap over LJ::get_cap($u, ...) (or add an accessor in LJ::User)
- English stripping is required for pages!
- New files need appropriate header/credit