WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#11971 closed defect (bug) (invalid)

WordPress Coding Standards

Reported by: 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 4 years ago.
KSES Indentations

Download all attachments as: .zip

Change History (6)

comment:1 nacin4 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.

comment:2 hakre4 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.

hakre4 years ago

KSES Indentations

comment:3 hakre4 years ago

X-Ref: #12519

comment:4 rmccue4 years ago

  • Keywords has-patch dev-feedback added

comment:5 nacin4 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.