summaryrefslogtreecommitdiffstats
path: root/PRESUBMIT.py
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-25 16:39:27 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-25 16:39:27 +0000
commitd25300196774987a6e745fbb0c01ba050fa913b7 (patch)
tree54fee8202f476638d57beb1a167772a08898d9ba /PRESUBMIT.py
parent7fb4650b772afc290726596aae10c922e87e9ef0 (diff)
downloadchromium_src-d25300196774987a6e745fbb0c01ba050fa913b7.zip
chromium_src-d25300196774987a6e745fbb0c01ba050fa913b7.tar.gz
chromium_src-d25300196774987a6e745fbb0c01ba050fa913b7.tar.bz2
Presubmit check for the name of png files. They should not have abbreviations.
NOTRY=true BUG=150046 TEST=none Review URL: https://chromiumcodereview.appspot.com/12047112 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@178837 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'PRESUBMIT.py')
-rw-r--r--PRESUBMIT.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 93236ff..738cae4 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -673,6 +673,24 @@ def _CheckHardcodedGoogleHostsInLowerLayers(input_api, output_api):
return []
+def _CheckNoAbbreviationInPngFileName(input_api, output_api):
+ """Makes sure there are no abbreviations in the name of PNG files.
+ """
+ pattern = input_api.re.compile(r'.*_[a-z]_|.*_[a-z].png$')
+ errors = []
+ for f in input_api.AffectedFiles(include_deletes=False):
+ if pattern.match(f.LocalPath()):
+ errors.append(' %s' % f.LocalPath())
+
+ results = []
+ if errors:
+ results.append(output_api.PresubmitError(
+ 'The name of PNG files should not have abbreviations. \n'
+ 'Use _hover.png, _center.png, instead of _h.png, _c.png.\n'
+ 'Contact oshima@chromium.org if you have questions.', errors))
+ return results
+
+
def _CommonChecks(input_api, output_api):
"""Checks common to both upload and commit."""
results = []
@@ -695,6 +713,7 @@ def _CommonChecks(input_api, output_api):
results.extend(_CheckForVersionControlConflicts(input_api, output_api))
results.extend(_CheckPatchFiles(input_api, output_api))
results.extend(_CheckHardcodedGoogleHostsInLowerLayers(input_api, output_api))
+ results.extend(_CheckNoAbbreviationInPngFileName(input_api, output_api))
if any('PRESUBMIT.py' == f.LocalPath() for f in input_api.AffectedFiles()):
results.extend(input_api.canned_checks.RunUnitTestsInDirectory(