Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(829)

Unified Diff: presubmit_support.py

Issue 13866044: Add cpplint to presubmit input_api (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: bump version Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « presubmit_canned_checks.py ('k') | tests/presubmit_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: presubmit_support.py
diff --git a/presubmit_support.py b/presubmit_support.py
index 814d3fc37a0d812bbb2bc977293ffe61113eb6d8..fe1c2878c5c27b64e75dfd36e2b456ac84aa43af 100755
--- a/presubmit_support.py
+++ b/presubmit_support.py
@@ -6,12 +6,13 @@
"""Enables directory-specific presubmit checks to run at upload and/or commit.
"""
-__version__ = '1.6.1'
+__version__ = '1.6.2'
# TODO(joi) Add caching where appropriate/needed. The API is designed to allow
# caching (between all different invocations of presubmit scripts for a given
# change). We should add it as our presubmit scripts start feeling slow.
+import cpplint
import cPickle # Exposed through the API.
import cStringIO # Exposed through the API.
import contextlib
@@ -247,6 +248,7 @@ class InputApi(object):
# so that presubmit scripts don't have to import them.
self.basename = os.path.basename
self.cPickle = cPickle
+ self.cpplint = cpplint
self.cStringIO = cStringIO
self.glob = glob.glob
self.json = json
@@ -283,6 +285,16 @@ class InputApi(object):
fopen=file, os_path=self.os_path, glob=self.glob)
self.verbose = verbose
+ # Replace <hash_map> and <hash_set> as headers that need to be included
+ # with "base/hash_tables.h" instead.
+ # Access to a protected member _XX of a client class
+ # pylint: disable=W0212
+ self.cpplint._re_pattern_templates = [
+ (a, b, 'base/hash_tables.h')
+ if header in ('<hash_map>', '<hash_set>') else (a, b, header)
+ for (a, b, header) in cpplint._re_pattern_templates
+ ]
+
def PresubmitLocalPath(self):
"""Returns the local path of the presubmit script currently being run.
« no previous file with comments | « presubmit_canned_checks.py ('k') | tests/presubmit_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698