Bug 34189 - check-webkit-style failed to complain about missing braces
Summary: check-webkit-style failed to complain about missing braces
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-26 16:07 PST by Evan Martin
Modified: 2014-03-11 07:50 PDT (History)
11 users (show)

See Also:


Attachments
Patch (5.47 KB, patch)
2014-03-06 05:42 PST, László Langó
no flags Details | Formatted Diff | Diff
patch for landing (5.52 KB, patch)
2014-03-11 07:12 PDT, László Langó
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Evan Martin 2010-01-26 16:07:00 PST
This patch:
https://bugs.webkit.org/show_bug.cgi?id=34186#c1

had this diff:

         ASSERT(U_SUCCESS(error));
+        for (unsigned i = 0; i < normalizedString.length(); ++i)
+            if (Font::treatAsSpace(m_normalizedBuffer[i]))
+                m_normalizedBuffer[i] = ' ';
 

Which I'm informed lacks parens.  But the style bot didn't mind it.
Comment 1 Evan Martin 2010-01-26 16:07:13 PST
Er, make that: "... which lacks *braces*."
Comment 2 Aivo Paas 2012-11-11 23:56:12 PST
@@ -1862,7 +1862,8 @@ bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& mouseEvent, Hi
         if (FrameView* view = m_frame->view()) {
             OptionalCursor optionalCursor = selectCursor(mev, scrollbar);
             if (optionalCursor.isCursorChange())
-                view->setCursor(optionalCursor.cursor());
+                m_currentMouseCursor = optionalCursor.cursor();
+                view->setCursor(m_currentMouseCursor);
         }
     }
Comment 3 BJ Burg 2014-03-02 11:20:29 PST
Ran into this again in review of https://bugs.webkit.org/show_bug.cgi?id=129388
Comment 4 László Langó 2014-03-06 01:51:50 PST
I have a draft patch for this. It works fine on the examples you mentioned previously, but it complains about this:

if (missedCues[i].data()->startTime() < missedCues[i].data()->endTime())
    eventTasks.append(std::make_pair(missedCues[i].data()->endTime(),
                                     missedCues[i].data()));

I'm a bit confused. Is this false positive or not? Should we use braces in this case?
Comment 5 László Langó 2014-03-06 05:42:00 PST
Created attachment 225982 [details]
Patch
Comment 6 László Langó 2014-03-06 05:43:00 PST
(In reply to comment #4)
> I have a draft patch for this. It works fine on the examples you mentioned previously, but it complains about this:
> 
> if (missedCues[i].data()->startTime() < missedCues[i].data()->endTime())
>     eventTasks.append(std::make_pair(missedCues[i].data()->endTime(),
>                                      missedCues[i].data()));
> 
> I'm a bit confused. Is this false positive or not? Should we use braces in this case?

Meanwhile I found the answer here: http://www.webkit.org/coding/coding-style.html#braces-one-line
Comment 7 Ryosuke Niwa 2014-03-11 00:42:55 PDT
Comment on attachment 225982 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=225982&action=review

rs=me.

> Tools/Scripts/webkitpy/style/checkers/cpp.py:2407
> +    if (match(r'^\s*\b(if|for|foreach|while|else)\b\s', line)

We don't want foreach here.
Comment 8 László Langó 2014-03-11 07:12:07 PDT
Created attachment 226423 [details]
patch for landing
Comment 9 WebKit Commit Bot 2014-03-11 07:50:55 PDT
Comment on attachment 226423 [details]
patch for landing

Clearing flags on attachment: 226423

Committed r165451: <http://trac.webkit.org/changeset/165451>
Comment 10 WebKit Commit Bot 2014-03-11 07:50:59 PDT
All reviewed patches have been landed.  Closing bug.