We've had some disagreement on the proper sort order of headers in my cube area. As far as I can tell, the style guide does not clearly define what order to put the following items in and reaching a consensus for consistencies sake would be great.
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
I believe this is standard for chrome.
> Short words at the end:
> a_b/c.h
> a_x/c.h
> a/c_b.h
> a/c_x.h
> a/c.h
> Omit non alpha-numeric order:
> a_b/c.h
> a/c_b.h
> a/c.h
> a/c_x.h
> a_x/c.h
> Omit non alpha-numeric within file/directory names:
> a/c_b.h
> a/c.h
> a/c_x.h
> a_b/c.h
> a_x/c.h
> --
> Steve
>
On Apr 12, 2011 8:44 PM, "Steve VanDeBogart" <van...@chromium.org> wrote:
>
> We've had some disagreement on the proper sort order of headers in my cube area. As far as I can tell, the style guide does not clearly define what order to put the following items in and reaching a consensus for consistencies sake would be great.
>
> a/c.h a/c_b.h a/c_x.h a_b/c.h a_x/c.h
>
> Some potential orderings:
>
> Unix "sort" order:
> a/c.h
> a/c_b.h
> a/c_x.h
> a_b/c.h
> a_x/c.h
This agrees with path-component-wise sorting, which I have so far assumed to be our style rule (but realizing at this point without good reason...)
>
> Short words at the end:
> a_b/c.h
> a_x/c.h
> a/c_b.h
> a/c_x.h
> a/c.h
>
> Omit non alpha-numeric order:
> a_b/c.h
> a/c_b.h
> a/c.h
> a/c_x.h
> a_x/c.h
>
> Omit non alpha-numeric within file/directory names:
> a/c_b.h
> a/c.h
> a/c_x.h
> a_b/c.h
> a_x/c.h
>
> --
> Steve
>
On Tue, Apr 12, 2011 at 11:43 AM, Steve VanDeBogart> Unix "sort" order:
> a/c.hI believe this is standard for chrome.
> a/c_b.h
> a/c_x.h
> a_b/c.h
> a_x/c.h
On Tue, Apr 12, 2011 at 11:43 AM, Steve VanDeBogart <van...@chromium.org> wrote:We've had some disagreement on the proper sort order of headers in my cube area. As far as I can tell, the style guide does not clearly define what order to put the following items in and reaching a consensus for consistencies sake would be great.I prefer no rule - too minor to matter.
On Tue, Apr 12, 2011 at 8:47 PM, Mike Belshe <mbe...@google.com> wrote:On Tue, Apr 12, 2011 at 11:43 AM, Steve VanDeBogart <van...@chromium.org> wrote:We've had some disagreement on the proper sort order of headers in my cube area. As far as I can tell, the style guide does not clearly define what order to put the following items in and reaching a consensus for consistencies sake would be great.I prefer no rule - too minor to matter.+1FWIW, I don't want to think about it, I just filter it through unix sort and forget it, and I don't care to comment on code reviews.
-eric
export LC_ALL=C
find chrome/browser/chromeos/ -name '*.h' -o -name '*.cc' \
| xargs grep -C1 '^#include' \
| awk -F: '$2 !~ "include" { prev=""; next } ($2 <= prev) {
print $1 } { prev=$2 }' \
| uniq \
| xargs -n1 sh -c 'cat "$1" \
| awk "{ tag=((/^#include/) \"_\" (/</)
\"_\" (/third.party/)); print tag \"\t\" \$0 }" \
| awk -vi=0 -F\\t "{ if (!/^1_0_/ || \$1 !=
prev) { ++i } } { printf \"%09d\t%s\n\",i,\$0; prev=\$1 }" \
| sort \
| sed "s/^[0-9]*\t[0-9]_[0-9]_[0-9]\t//" >
"$1".fixed; mv -f "$1".fixed "$1"' xxx