[webkit-reviews] review granted: [Bug 27354] cpplint should check for one line control statements surrounded by braces : [Attachment 32902] Second version

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jul 16 17:21:01 PDT 2009


David Levin <levin at chromium.org> has granted Adam Treat <treat at kde.org>'s
request for review:
Bug 27354: cpplint should check for one line control statements surrounded by
braces
https://bugs.webkit.org/show_bug.cgi?id=27354

Attachment 32902: Second version
https://bugs.webkit.org/attachment.cgi?id=32902&action=review

------- Additional Comments from David Levin <levin at chromium.org>

> diff --git a/WebKitTools/Scripts/modules/cpplint.py
b/WebKitTools/Scripts/modules/cpplint.py
> +    if (match(r'\s*}\s*$', line)
> +	   and line_number > 1):

You might as well put this on one line.  In general, feel free to make the
lines as long as you wish.  (Most of the code was developed using 80 characters
limits so sometimes it seems to do weird line wrappings to meet this
requirement.)


> +	   # We check if a closed brace has started a line to see if a
> +	   # one line control statement was previous

Nice to add a "." to the end of your sentence.

> +	   previous_line = clean_lines.elided[line_number - 2]
> +	   if (previous_line.find('{') > 0
> +	       and search(r'\b(if|for|while|else)\b', previous_line)):
> +	       error(filename, line_number, 'whitespace/braces', 4,
> +		     'One line control clauses should not use braces')

Nice to add a "." to the end of your sentence.


More information about the webkit-reviews mailing list