Bug 32991 - [Qt] check-webkit-style generates false report on "#include *.moc"
Summary: [Qt] check-webkit-style generates false report on "#include *.moc"
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P3 Normal
Assignee: Chang Shu
URL:
Keywords: Qt
Depends on:
Blocks:
 
Reported: 2009-12-28 12:33 PST by Chang Shu
Modified: 2009-12-29 15:06 PST (History)
5 users (show)

See Also:


Attachments
fix patch (1.37 KB, patch)
2009-12-28 12:43 PST, Chang Shu
eric: review-
Details | Formatted Diff | Diff
alternative fix (1.88 KB, patch)
2009-12-29 10:15 PST, Chang Shu
abarth: review-
Details | Formatted Diff | Diff
added unit tests (3.04 KB, patch)
2009-12-29 13:19 PST, Chang Shu
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chang Shu 2009-12-28 12:33:27 PST
check-webkit-style generated the following error report on patch 45564 in bug 32614.
Failed to run "WebKitTools/Scripts/check-webkit-style" exit_code: 1
JavaScriptCore/wtf/qt/ThreadingQt.cpp:293:  Found header this file implements
after other header. Should be: config.h, primary header, blank line, and then
alphabetically sorted.  [build/include_order] [4]
Total errors found: 1

I think it's a false alarm.
Lines like "#include ThreadingQt.moc" in a Qt cpp file should not follow the general include style.
Comment 1 Chang Shu 2009-12-28 12:43:32 PST
Created attachment 45568 [details]
fix patch

Include files ending with ".moc" were accidentally categorized as PRIMARY_HEADER.
Comment 2 WebKit Review Bot 2009-12-28 12:47:10 PST
style-queue ran check-webkit-style on attachment 45568 [details] without any errors.
Comment 3 Eric Seidel (no email) 2009-12-29 00:06:09 PST
Comment on attachment 45568 [details]
fix patch

This requires a unittest.  I'm not familiar enough with this code to know if this is the right approach.
Comment 4 Chang Shu 2009-12-29 06:53:51 PST
(In reply to comment #3)
> (From update of attachment 45568 [details])
> This requires a unittest.  I'm not familiar enough with this code to know if
> this is the right approach.

The line I have changed is to check the primary header by comparing the base file name. For example, if the cpp file is test.cpp, test.h will be the primary header. However, for Qt, a line such as "#include test.moc" may show up at the end of the file. Its base name is also "test" but we should exclude this from primary header.
Comment 5 Chang Shu 2009-12-29 10:15:31 PST
Created attachment 45612 [details]
alternative fix

This is an alternative fix. It simply changes the order of processing headers.
Comment 6 WebKit Review Bot 2009-12-29 10:19:19 PST
style-queue ran check-webkit-style on attachment 45612 [details] without any errors.
Comment 7 Adam Barth 2009-12-29 11:47:21 PST
Comment on attachment 45612 [details]
alternative fix

I'm not a cpp_lint expert, but this second patch looks like a good approach.  However, we still need a test.  cpp_lint has extensive unit tests.  It should be straightforward to modify one to test this new behavior.
Comment 8 Chang Shu 2009-12-29 13:19:24 PST
Created attachment 45620 [details]
added unit tests

2 new unit tests added for Qt moc headers.
Comment 9 WebKit Review Bot 2009-12-29 13:21:17 PST
style-queue ran check-webkit-style on attachment 45620 [details] without any errors.
Comment 10 Adam Barth 2009-12-29 13:58:35 PST
Comment on attachment 45620 [details]
added unit tests

LGTM.  A cpp_lint expert might want to double check.  Thanks for the test.
Comment 11 WebKit Commit Bot 2009-12-29 15:06:40 PST
Comment on attachment 45620 [details]
added unit tests

Clearing flags on attachment: 45620

Committed r52636: <http://trac.webkit.org/changeset/52636>
Comment 12 WebKit Commit Bot 2009-12-29 15:06:48 PST
All reviewed patches have been landed.  Closing bug.