From d25300196774987a6e745fbb0c01ba050fa913b7 Mon Sep 17 00:00:00 2001 From: "oshima@chromium.org" Date: Fri, 25 Jan 2013 16:39:27 +0000 Subject: 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 --- PRESUBMIT.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'PRESUBMIT.py') 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( -- cgit v1.1