Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#11971 closed defect (bug) (invalid)

WordPress Coding Standards

Reported by: hakre's profile hakre Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: General Keywords: has-patch dev-feedback
Focuses: Cc:

Description

In the continuous effort to better apply the wordpress coding standards on the codebase this ticket has been created to collect explicit coding standard related patches.

Based on todays Dev Meeting.

Attachments (1)

11971.000.kses.patch (16.1 KB) - added by hakre 15 years ago.
KSES Indentations

Download all attachments as: .zip

Change History (6)

#1 @nacin
15 years ago

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.

#2 @hakre
15 years ago

Thanks for the feedback. Regarding general discussion, I should have linked the wordpress coding standards blog post. I think it's better to have the cases there for a discussion, but them then into codex when they seem fit and leave this ticket for the patches.

@hakre
15 years ago

KSES Indentations

#4 @rmccue
15 years ago

  • Keywords has-patch dev-feedback added

#5 @nacin
15 years ago

  • Milestone 3.0 deleted
  • Resolution set to invalid
  • Status changed from new to closed

There's nothing in the patch here we need to do or isn't already handled (the unnecessary isset() checks are gone).

I'd rather handle cleanups as we go. Please open new tickets if there are any specific patches.

Note: See TracTickets for help on using tickets.