WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
128751
[check-webkit-style] False positive when using the ternary operators with multiple lines.
https://bugs.webkit.org/show_bug.cgi?id=128751
Summary
[check-webkit-style] False positive when using the ternary operators with mul...
Javier Fernandez
Reported
2014-02-13 11:32:55 PST
This scenario triggers the following style issue: * Wrong number of spaces before statement. (expected: 24) [whitespace/indent] [4] For what could understand, the use of the ternary operator in multiple lines makes the style checker to trigger indent issues in different lines. These lines in the CSSParser.cpp file are the root cause of the problem: RefPtr<CSSPrimitiveValue> amount = arg->id == CSSValueAuto ? cssValuePool().createIdentifierValue(CSSValueAuto) : createPrimitiveNumericValue(arg); I'm not really sure whether such syntax is correct or not. If it's correct, this is a false positive, otherwise this bug should be resolved by adding a new style check to prevent that way of using the ternary operator.
Attachments
Add attachment
proposed patch, testcase, etc.
László Langó
Comment 1
2014-03-21 06:40:50 PDT
I think the ternary operator should be use only in short cases. If your code with ternary operator does not fit into one line, then you should use if-else instead. We don't have any rule for this case as I know, but maybe this would be useful.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug