[wp-trac] [WordPress Trac] #11971: WordPress Coding Standards

WordPress Trac wp-trac at lists.automattic.com
Thu Jan 21 22:55:18 UTC 2010


#11971: WordPress Coding Standards
--------------------------+-------------------------------------------------
 Reporter:  hakre         |       Owner:     
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  3.0
Component:  General       |     Version:  3.0
 Severity:  normal        |    Keywords:     
--------------------------+-------------------------------------------------

Comment(by nacin):

 I have noticed two things that are especially inconsistent, so I may as
 well point those out.
 {{{
 __( 'This is a string' ); _e( 'This is a string' );
 __('This is a string');   _e('This is a string');
 }}}
 The first is spacing around calls to L10n functions. Last I checked,
 instances of no spacing outnumber instances of spacing about 3:1. The
 standards document technically calls for spacing here. I personally think
 that single-argument calls to {{{__()}}} and {{{_e()}}} look fine if not
 better without spaces, but either way they should be consistent.

 The second is the use of {{{!}}} as a logical operator:
 {{{
 if ( ! empty( $_POST['blah'] ) )
 if ( !empty( $_POST['blah'] ) )
 }}}
 I'm not sure which appears more in core, and the coding standards aren't
 specific, though I would assume the space is preferred.

 That all said, I think it would be more effective to concentrate
 housekeeping efforts on improving and adding inline documentation, which
 is far more important, and work to improve coding standards whenever
 possible whenever patching or committing nearby changes.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11971#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list