WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 17 months ago

#29928 closed enhancement (wontfix)

WP Core should adhere to its own coding standards

Reported by: aristath Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:

Description

We should go over all files in WP Core and update them to adhere to our Coding Standards: https://make.wordpress.org/core/handbook/coding-standards/

I'll start submitting patches later today and I'll try to make them 1 patch per file.

I know this is going to be a massive task, but it has to be done.

My goal is to go over all PHP files by the end of the month.

Change History (5)

#1 @kpdesign
5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed
  • Version trunk deleted

Please note that formatting cleanup tickets are generally discouraged. Coding style fixes should be a result of more substantial changes to reduce undue churn in the codebase: https://make.wordpress.org/core/2011/03/23/code-refactoring/.

#2 follow-up: @aristath
5 years ago

  • Resolution wontfix deleted
  • Status changed from closed to reopened

So what you're saying is that I shouldn't try to improve the WordPress codebase this way?
WordPress has some coding standards that are good to have and we should definitely follow them in-core instead of having messy code all over the place!

Nacin on his post there clearly states that "Proper justification and clear rationale of changes are both necessary. Too often it is impossible to determine the purpose, objective, or focus of these patches. Code should not be rewritten under the cloaks of readability, narrow personal opinion, or general subjectiveness."

So let me address these 1 by 1:
Purpose: we can't have coding standards and then ignore them completely on our own code. It's irrational.
Objective: consistent coding and readability.

Adhering to WordPress standards in NOT a "cloak". It's both justified and rational. What could be more rational that sticking to the principals we try to teach to other devs...
Nor is this a personal opinion. Coding standards have a very good reason of existence.

This doesn't make any sense at all....

#3 in reply to: ↑ 2 @ocean90
5 years ago

  • Focuses docs removed
  • Resolution set to wontfix
  • Status changed from reopened to closed

Replying to aristath:

So what you're saying is that I shouldn't try to improve the WordPress codebase this way?

When you have something related to inline docs that's okay, but please open separated tickets for them. When you just want to "improve" the whitespace or brackets usage, that's discouraged.

we can't have coding standards and then ignore them completely on our own code.

We don't ignore them. Any new code which is committed to core applies to the new coding standards.

#4 @nacin
5 years ago

Replying to aristath:

That post more generally applies to refactoring, not just coding standards. But it links to a document on contributing to Linux that specifically applies to coding standards. I've updated the link (it was broken). See http://www.linuxfoundation.org/content/41-pitfalls, the "Coding style" section.

#5 @aristath
17 months ago

It took 3 years, but I'm glad this was finally done in https://core.trac.wordpress.org/ticket/41057

Note: See TracTickets for help on using tickets.