For example, see this comment: https://bugs.webkit.org/show_bug.cgi?id=39327#c4
*** Bug 39787 has been marked as a duplicate of this bug. ***
Created attachment 57933 [details]
Created attachment 57968 [details]
It would be good if the patch had a test and I'm not certain of some of the changes done.
I've added two folks who know this code much better than I do (and I'm hoping one of them will look this over).
Comment on attachment 57968 [details]
Yeah, I think we want some test cases for this change.
+ def check_next_include_order(self, header_type, file_is_header, include_state):
I think we can just use self as include_state?
+ for line_number in xrange(clean_lines.num_lines()):
It's unfortunate we need to iterate all lines twice. Cannot we implement this by one-pass approach? Maybe it should be like
1. If primary header comes before config.h, emit a warning when we find config.h
2. If primary header isn't found between config.h and "other headers", set has_primary_header=False
3. If primary header is found after we see at least one "other headers", emit a warning.
Created attachment 89691 [details]
This fix checks whether primary header exists, and only requires the #include if it does.
Attachment 89691 [details] did not pass style-queue:
Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Tools/ChangeLog', u'Tools/Scripts/webkitpy..." exit_code: 1
Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py:2615: trailing whitespace [pep8/W291] 
Tools/Scripts/webkitpy/style/checkers/cpp.py:2600: expected 2 blank lines, found 1 [pep8/E302] 
Tools/Scripts/webkitpy/style/checkers/cpp.py:2601: trailing whitespace [pep8/W291] 
Tools/Scripts/webkitpy/style/checkers/cpp.py:2605: whitespace before ':' [pep8/E203] 
Total errors found: 4 in 3 files
If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 89691 [details]
View in context: https://bugs.webkit.org/attachment.cgi?id=89691&action=review
What the stylebot said plus a few other things to consider.
> + def check_next_include_order(self, header_type, file_is_header, has_primary_header):
has_primary_header seems ambiguous to me.
What about primary_header_exists?
>> +def _has_primary_header(filename):
> expected 2 blank lines, found 1 [pep8/E302] 
> + if the file is not source file or primary header does not exist
> + if os.path.isfile(primary_header):
You could just
> + # File with non-existing primary header should not produce errors
Add . after comments (and other places).
Created attachment 89701 [details]
Simple fix + CR addressed
CR addressed + style violations (sorry - I keep forgetting running the cop - I will).
The commit-queue encountered the following flaky tests while processing attachment 89701 [details]:
http/tests/xmlhttprequest/basic-auth-default.html bug 58666 (author: email@example.com)
The commit-queue is continuing to process your patch.
Comment on attachment 89701 [details]
Simple fix + CR addressed
Clearing flags on attachment: 89701
Committed r83977: <http://trac.webkit.org/changeset/83977>
All reviewed patches have been landed. Closing bug.