RESOLVED FIXED 9671
Style rules not supported by autoformatters
https://bugs.webkit.org/show_bug.cgi?id=9671
Summary Style rules not supported by autoformatters
Michael Emmel
Reported 2006-06-30 16:13:09 PDT
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.
Attachments
Format rules using astyle (486 bytes, text/plain)
2006-10-25 22:32 PDT, Michael Emmel
mjs: review-
Format rules using astyle (486 bytes, text/plain)
2006-10-25 22:33 PDT, Michael Emmel
mjs: review-
astyle and sed script for webkit style rules (882 bytes, patch)
2006-10-31 09:02 PST, Michael Emmel
mjs: review-
Style script (2.97 KB, patch)
2006-11-02 08:56 PST, Michael Emmel
mjs: review+
Michael Emmel
Comment 1 2006-10-18 09:53:38 PDT
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.
Michael Emmel
Comment 2 2006-10-25 22:32:35 PDT
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
Michael Emmel
Comment 3 2006-10-25 22:33:24 PDT
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
Maciej Stachowiak
Comment 4 2006-10-31 04:00:00 PST
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.
Maciej Stachowiak
Comment 5 2006-10-31 04:14:27 PST
Comment on attachment 11221 [details] Format rules using astyle r- because this is not a patch. Please resubmit as a patch, thanks!
Maciej Stachowiak
Comment 6 2006-10-31 04:14:31 PST
Comment on attachment 11220 [details] Format rules using astyle r- because this is not a patch. Please resubmit as a patch, thanks!
Michael Emmel
Comment 7 2006-10-31 09:02:39 PST
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.
Maciej Stachowiak
Comment 8 2006-11-01 19:02:12 PST
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.
Michael Emmel
Comment 9 2006-11-02 08:56:37 PST
Created attachment 11347 [details] Style script Patch with copyright and changelog entry
Maciej Stachowiak
Comment 10 2006-11-03 04:05:23 PST
Thanks, r=me
Maciej Stachowiak
Comment 11 2006-11-03 05:01:53 PST
Oops, didn't mean to close this.
Maciej Stachowiak
Comment 12 2006-11-03 05:02:18 PST
Comment on attachment 11347 [details] Style script r=me
Alexey Proskuryakov
Comment 13 2006-11-03 11:05:51 PST
Committed revision 17575.
David Kilzer (:ddkilzer)
Comment 14 2009-03-10 11:29:36 PDT
See also Bug 17124.
Note You need to log in before you can comment on or make changes to this bug.