summaryrefslogtreecommitdiffstats
path: root/chrome/PRESUBMIT.py
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-17 18:54:53 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-17 18:54:53 +0000
commit93b2d737407389a1c4dbc67836a949663eeba948 (patch)
treec5f9a4eef1e5199d758a94e28f7add9907e12f2c /chrome/PRESUBMIT.py
parent83e5ec4e02e2c061793488b7bbc5bb83ae6c7c97 (diff)
downloadchromium_src-93b2d737407389a1c4dbc67836a949663eeba948.zip
chromium_src-93b2d737407389a1c4dbc67836a949663eeba948.tar.gz
chromium_src-93b2d737407389a1c4dbc67836a949663eeba948.tar.bz2
Call the new presubmit checks from chrome/ code, with a blacklist.
Review URL: http://codereview.chromium.org/400014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32190 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/PRESUBMIT.py')
-rwxr-xr-xchrome/PRESUBMIT.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/chrome/PRESUBMIT.py b/chrome/PRESUBMIT.py
new file mode 100755
index 0000000..26c2ed4
--- /dev/null
+++ b/chrome/PRESUBMIT.py
@@ -0,0 +1,51 @@
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Makes sure that the chrome/ code is cpplint clean."""
+
+INCLUDE_CPP_FILES_ONLY = (
+ r'.*\.cc$', r'.*\.h$'
+)
+
+EXCLUDE = (
+ # Objective C confuses everything.
+ r'.*cocoa.*',
+ r'.*_mac\.(cc|h)$',
+ r'.*_mac_.*',
+ # All the messages files do weird multiple include trickery
+ r'.*_messages_internal\.h$',
+ r'render_messages.h$',
+ # Autogenerated window resources files are off limits
+ r'.*resource.h$',
+ # GTK macros in C-ish header code cause false positives
+ r'gtk_.*\.h$',
+ # Header trickery
+ r'.*-inl\.h$',
+ # Templates
+ r'sigslotrepeater\.h$',
+ # GCC attribute trickery
+ r'sel_main\.cc$',
+ # Mozilla code
+ r'mork_reader\.h$',
+ r'mork_reader\.cc$',
+ r'nss_decryptor_linux\.cc$',
+ # Has safe printf usage that cpplint complains about
+ r'safe_browsing_util\.cc$',
+ # Too much math on one line?
+ r'bloom_filter\.cc$',
+ # Bogus ifdef tricks
+ r'renderer_webkitclient_impl\.cc$',
+ r'temp_scaffolding_stubs\.h$',
+ # Lines > 100 chars
+ r'gcapi\.cc$',
+)
+
+def CheckChangeOnUpload(input_api, output_api):
+ results = []
+ black_list = input_api.DEFAULT_BLACK_LIST + EXCLUDE
+ sources = lambda x: input_api.FilterSourceFile(
+ x, white_list=INCLUDE_CPP_FILES_ONLY, black_list=black_list)
+ results.extend(input_api.canned_checks.CheckChangeLintsClean(
+ input_api, output_api, sources))
+ return results