Ticket #986 (closed enhancement: fixed)

Opened 7 years ago

Last modified 5 years ago

Code Cleanup: Tabs instead of Four Spaces

Reported by: MaThIbUs Owned by: skippy
Priority: low Milestone: 2.1
Component: General Version: 2.1
Severity: minor Keywords: bg|dev-feedback bg|has-patch
Cc: MaThIbUs

Description

WordPress can be made even more lightweight by replacing every instance of four repetitive spaces by a tab. I did this for the whole wp-includes/ directory. [Patch included.] Its size went from 406,374 bytes to 383,963 bytes. Spaces are all over the place.

Attachments

986-import.diff Download (23.2 KB) - added by Nazgul 6 years ago.
986-admin.diff Download (172.1 KB) - added by Nazgul 6 years ago.
986-plugins.diff Download (5.3 KB) - added by Nazgul 6 years ago.
986-themes.diff Download (19.8 KB) - added by Nazgul 6 years ago.
986-root.diff Download (69.2 KB) - added by Nazgul 6 years ago.
986-includes.diff Download (210.5 KB) - added by Nazgul 6 years ago.

Change History

  • Patch set to No

comment:2   ryan7 years ago

If we do this, let's wait for a major release. I personally loathe tabs, but the official WP coding guidelines require them. So, doing a big tabify commit at the start of our next major release development cycle could happen. I'd rather not churn the files in the 1.5 dot releases.

edited on: 02-26-05 21:02

  • Keywords bg|dev-feedback added
  • Owner changed from anonymous to skippy
  • Version changed from 1.5.1 to 1.6
  • Status changed from new to assigned
  • Priority changed from normal to low

I agree this is a good idea; and 1.6 makes a good target for this.

  • Milestone set to 1.6

Agreed. 1.6 milestone.

This should be checked over though, and not a blind search/replace. I've seen 5 spaces be used sometimes, not just 4... so if you just replaced 4 spaces, you'd be left with tab + single space.

I don't know if we should be doing this as we patch other issues or on a pure cleanup patch run... or a little of each. I find it hard to resist doing code cleanup as I go, and MaThIbUs is the same way. The only problem with that is that it clutters up the changeset... makes it harder to see what actual functional code was changed.

This should be checked over though, and not a blind search/replace. I've seen 5 spaces be used sometimes, not just 4... so if you just replaced 4 spaces, you'd be left with tab + single space.

Indeed. I actually spent an entire morning creating the patch that has now been deleted, just because of the many repetitive spaces used in functions (i.e. that have their use) and the 5 vs. 4 spaces thing. So... yeahhh.

The excellent UltraEdit-32 Text-Editor features some 1337 functions for this stuff ("Leading Spaces to Tabs", just one click on a button!).

comment:6   matt6 years ago

  • Milestone changed from 1.6 to 2.1

I'm going to be working through the files in batches, fixing this and many more problems. Going to wait until some of my pending fixes go in before spending time on this... this is the kind of patch you want to go in immediately, before any other code is changed.

Nazgul6 years ago

Nazgul6 years ago

Nazgul6 years ago

Nazgul6 years ago

Nazgul6 years ago

Nazgul6 years ago

  • Keywords bg|has-patch added
  • Version changed from 1.6 to 2.1
  • Type changed from defect to enhancement

I've made some patches that remove trailing spaces and converts starting spaces to tabs. It's not perfect, but it gets us in that direction.

comment:9   ryan5 years ago

  • Status changed from assigned to closed
  • Resolution set to fixed

(In [4495]) Remove trailing spaces and convert spaces to tabs. Props Nazgul. fixes #986

Note: See TracTickets for help on using tickets.