The current style rules for WebKit http://webkit.opendarwin.org/coding/coding-style.html Are not directly supported by available auto-code formatters astyle,indent etc. First it would be nice to develop either a modified style guidelines that would allow the use of at least one command line code formatter. I've developed a set of rules for astyle that seem close. astyle \ --mode=c \ --convert-tabs \ --indent=spaces=4 \ --brackets=linux \ --indent-switches \ --max-instatement-indent=40 \ --min-conditional-indent=4 \ --one-line=keep-statements \ --one-line=keep-blocks \ --pad=oper \ $@ But they do not work completely namespace foo { becomes namespace foo { And if() -> if () is not supported. Other artifacts are possbile. The following is needed 1.) Determine the best formatter 2.) Modify formatter if needed to fit the current rules. 3.) Change the rules to follow the formatter where its difficult or impossible to follow the current formatting rules. Note desired formatting that is not handled by auto formatting as strong suggestions. Finally schedule a full reformat of the code base if desired.
I made this bug critical because until the choice of auto formatting tools is chosen it blocks contributions to webkit from people with a disability like dyslexia from contributing. The first step is to determine which autoformat tools are candidates for acceptance. Eclipse might be a good choice for example. Next since almost all of these tools produce unwanted changes we need to identify those. In most cases simple pattern matches can be used to find and revert unwanted autoformat changes.
Created attachment 11220 [details] Format rules using astyle This script almost formats correctly for the Webkit style guidlines The current obvious failure is bit vars used in node and other place are not formatted correctly thus foo:1 is turun
Created attachment 11221 [details] Format rules using astyle This script almost formats correctly for the Webkit style guidlines The current obvious failure is bit vars used in node and other place are not formatted correctly thus foo:1; becomes foo: 1; foo:1 is turun
The autoformatting script looks good, but I'm not sure what you'd like us to do with it since it is not, as such, a patch. If you provide a patch to add the script to WebKitTools/Scripts (with a ChangeLog or what have you) I'll happily r+ it.
Comment on attachment 11221 [details] Format rules using astyle r- because this is not a patch. Please resubmit as a patch, thanks!
Comment on attachment 11220 [details] Format rules using astyle r- because this is not a patch. Please resubmit as a patch, thanks!
Created attachment 11299 [details] astyle and sed script for webkit style rules Astyle does not handle WebKit C++ class constructor rules. And it messes up on formatting bitfields. I will file a astyle bug on this.
Comment on attachment 11299 [details] astyle and sed script for webkit style rules Thanks! Also needs a ChangeLog entry and copyright notice. Please add these.
Created attachment 11347 [details] Style script Patch with copyright and changelog entry
Thanks, r=me
Oops, didn't mean to close this.
Comment on attachment 11347 [details] Style script r=me
Committed revision 17575.
See also Bug 17124.