Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#12196 closed task (fixed)

Clean whitespace at release time

Reported by: rmurphey Owned by: dante
Priority: high Milestone: 1.6
Component: General Version: 1.6.0b1
Keywords: Cc:
Blocked By: Blocking:

Description

The code across dojo, dijit, and dojox has a lot of trailing whitespace issues. Pete and I came up with a simple command line perl thing that will clean it up:

perl -p -e 's/(\S+)\s+(\n)$/$1$2/g'

(Improvements welcome -- we reviewed the diff this creates and it looks sane.)

This should probably be part of the pre-release cleanup, but it probably also makes sense to have some pre-commit test or auto-cleanup first, so that new code with trailing whitespace doesn't get committed.

Attachments (3)

demos-whitespace.diff.gz (21.7 KB) - added by dante 8 years ago.
small diff
dijit-whitespace.diff.gz (14.8 KB) - added by dante 8 years ago.
dojo-whitespace.diff.gz (150.9 KB) - added by dante 8 years ago.

Download all attachments as: .zip

Change History (14)

comment:1 Changed 8 years ago by dante

Milestone: tbd1.6
Owner: changed from anonymous to dante
Status: newassigned

Changed 8 years ago by dante

Attachment: demos-whitespace.diff.gz added

small diff

Changed 8 years ago by dante

Attachment: dijit-whitespace.diff.gz added

Changed 8 years ago by dante

Attachment: dojo-whitespace.diff.gz added

comment:2 Changed 8 years ago by dante

the dojox-whitespace.diff is 1.7megs, and even gzipped doesn't fit in the attachment limit size. can break it into per-project .diffs

comment:3 Changed 8 years ago by Colin Snover

find /path/to/dojo-src -type f -name "*.js" -exec sed -e 's/[[:space:]]*$//g' {} \; works great; used it to clean up my jQueries just the other day.

comment:4 in reply to:  3 Changed 8 years ago by rmurphey

Replying to csnover:

find /path/to/dojo-src -type f -name "*.js" -exec sed -e 's/[[:space:]]*$//g' {} \; works great; used it to clean up my jQueries just the other day.

I don't think that does exactly the same thing as the regex that we arrived at, which is intended to only remove whitespace on lines that have a character on them; lines that contain only whitespace are not changed for reasons that I'll leave it to phiggins to explain.

comment:5 Changed 8 years ago by dante

(In [23843]) massive whitespace fix refs #12196 \!strict

comment:6 Changed 8 years ago by dante

(In [23844]) massive whitespace fix refs #12196 \!strict

comment:7 Changed 8 years ago by dante

(In [23845]) massive whitespace fix refs #12196 \!strict

comment:8 Changed 8 years ago by dante

(In [23846]) massive whitespace fix refs #12196 \!strict

comment:9 Changed 8 years ago by dante

(In [23847]) massive whitespace fix refs #12196 \!strict

comment:10 Changed 8 years ago by dante

Resolution: fixed
Status: assignedclosed

the command was:

find . -name "*.js" | xargs perl -p -i -e 's/(\S+)\s+(\n)$/$1$2/g'

for the record.

comment:11 Changed 8 years ago by bill

(In [23862]) tabbing fixes, refs #12196

Note: See TracTickets for help on using tickets.