Whitespace


Questions, Explanations, Howtos

Ziggurat Zagger

Posts: 3163

Joined: Friday, 6th January 2012, 18:45

Post Wednesday, 28th August 2013, 15:26

Whitespace

I notice a lot of commits involve the devs with commit rights tidying up stray whitespace from submitted patches. Can anyone offer tips to reduce the need for this? Do you guys just scan the diff looking for extra spaces or is there a script I could write/run that looks for it?
User avatar

Dungeon Master

Posts: 4031

Joined: Thursday, 16th December 2010, 20:37

Location: France

Post Wednesday, 28th August 2013, 16:21

Re: Whitespace

util/checkwhite
<+Grunt> You dereference an invalid pointer! Ouch! That really hurt! The game dies...

For this message the author galehar has received thanks:
BlackSheep
User avatar

Dungeon Master

Posts: 502

Joined: Wednesday, 7th March 2012, 13:25

Location: Lexington, KY, US

Post Wednesday, 28th August 2013, 16:26

Re: Whitespace

Just run utils/checkwhite from the source directory. It will fix all the problems it finds, though sometimes it incorrectly guesses what you meant by a tab (eight spaces or four).

Other formatting fixes (brace usage, indentation of multi-line expressions, and so on; see docs/develop/coding_conventions.txt) are usually identified and corrected by hand.

For this message the author neil has received thanks:
BlackSheep

Ziggurat Zagger

Posts: 3163

Joined: Friday, 6th January 2012, 18:45

Post Friday, 6th September 2013, 16:40

Re: Whitespace

When I run checkwhite under msysgit it seems to remove all carriage returns. Then when I commit changes, I get "warning: LF will be replaced by CRLF in crawl-ref/source/newgame.cc."

Is that just a quirk of windows or is there a setting I can change to make the CR/LF more consistent?
User avatar

Dungeon Master

Posts: 4031

Joined: Thursday, 16th December 2010, 20:37

Location: France

Post Saturday, 7th September 2013, 14:38

Re: Whitespace

You need to set autocrlf = false in git config.
That way, line endings are kept in unix format and checkwhite won't mess with them.
<+Grunt> You dereference an invalid pointer! Ouch! That really hurt! The game dies...

Return to Coding

Who is online

Users browsing this forum: No registered users and 14 guests

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.