Bug 28370 - check-webkit-style: add check for 'using std::foo;' statements
Summary: check-webkit-style: add check for 'using std::foo;' statements
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-16 15:35 PDT by David Kilzer (:ddkilzer)
Modified: 2009-08-16 17:45 PDT (History)
3 users (show)

See Also:


Attachments
Patch v1 (4.35 KB, patch)
2009-08-16 15:35 PDT, David Kilzer (:ddkilzer)
levin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2009-08-16 15:35:54 PDT
Created attachment 34940 [details]
Patch v1

Reviewed by NOBODY (OOPS!).

In <http://webkit.org/b/28355#c1>, it was noted that new source
files use 'using namespace std;' instead of individual
'use std::foo;' statements.  This adds a level 4 check for such
statements.

* Scripts/modules/cpp_style.py:
(_ERROR_CATEGORIES): Added 'build/using_std'.
(check_using_std): Added.
(check_style): Added call to check_using_std().
* Scripts/modules/cpp_style_unittest.py:
(WebKitStyleTest.test_using_std): Added unit test.
---
 3 files changed, 54 insertions(+), 0 deletions(-)
Comment 1 David Kilzer (:ddkilzer) 2009-08-16 15:52:37 PDT
(In reply to comment #0)
> In <http://webkit.org/b/28355#c1>, it was noted that new source
> files use 'using namespace std;' instead of individual
> 'use std::foo;' statements.  This adds a level 4 check for such
> statements.

That should be 'using std::foo;' in the ChangeLog comment.  Already fixed locally.
Comment 2 David Levin 2009-08-16 16:31:22 PDT
Comment on attachment 34940 [details]
Patch v1

> +          'Use \'using namespace std;\' instead of \'using std::%s;\'.' % method_name)

Consider using "" for the outer quotes to avoid the \' because it makes it easier to read. Like this:

          "Use 'using namespace std;' instead of 'using std::%s;'." % method_name)


> diff --git a/WebKitTools/Scripts/modules/cpp_style_unittest.py b/WebKitTools/Scripts/modules/cpp_style_unittest.py
> +            'Use \'using namespace std;\' instead of \'using std::min;\'.'

Consider using "" for the outer quotes to avoid the \'.
Comment 3 David Kilzer (:ddkilzer) 2009-08-16 17:45:03 PDT
Committing to http://svn.webkit.org/repository/webkit/trunk ...
	M	WebKitTools/ChangeLog
	M	WebKitTools/Scripts/modules/cpp_style.py
	M	WebKitTools/Scripts/modules/cpp_style_unittest.py
Committed r47346
	M	WebKitTools/ChangeLog
	M	WebKitTools/Scripts/modules/cpp_style_unittest.py
	M	WebKitTools/Scripts/modules/cpp_style.py
r47346 = b78d6ef8825272cc9ccf21957ae16d96d64080c7 (trunk)
No changes between current HEAD and refs/remotes/trunk
Resetting to the latest refs/remotes/trunk
http://trac.webkit.org/changeset/47346
Comment 4 David Kilzer (:ddkilzer) 2009-08-16 17:45:08 PDT
All reviewed patches have been landed.  Closing bug.