| Index: chrome/browser/PRESUBMIT.py
|
| diff --git a/chrome/browser/PRESUBMIT.py b/chrome/browser/PRESUBMIT.py
|
| index 70d0b56e5824869e6c388c692559fc2d4eb49e2b..87442ff7b5a759e86cdce57764abdae68cb7c9cf 100644
|
| --- a/chrome/browser/PRESUBMIT.py
|
| +++ b/chrome/browser/PRESUBMIT.py
|
| @@ -2,22 +2,7 @@
|
| # Use of this source code is governed by a BSD-style license that can be
|
| # found in the LICENSE file.
|
|
|
| -"""Presubmit script for Chromium browser code.
|
| -
|
| -This script currently checks HTML/CSS/JS files in resources/ and ui/webui/.
|
| -
|
| -See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
|
| -for more details about the presubmit API built into depot_tools, and see
|
| -https://chromium.googlesource.com/chromium/src/+/master/styleguide/web/web.md
|
| -for the rules checked for here.
|
| -"""
|
| -
|
| -def CheckChangeOnUpload(input_api, output_api):
|
| - return _CommonChecks(input_api, output_api)
|
| -
|
| -
|
| -def CheckChangeOnCommit(input_api, output_api):
|
| - return _CommonChecks(input_api, output_api)
|
| +"""Presubmit script for Chromium browser code."""
|
|
|
| def _RunHistogramChecks(input_api, output_api, histogram_name):
|
| try:
|
| @@ -47,61 +32,12 @@ def _RunHistogramChecks(input_api, output_api, histogram_name):
|
|
|
| def _CommonChecks(input_api, output_api):
|
| """Checks common to both upload and commit."""
|
| - results = []
|
| -
|
| - path = input_api.os_path
|
| - cwd = input_api.PresubmitLocalPath()
|
| - resources = path.join(cwd, 'resources')
|
| - webui = path.join(cwd, 'ui', 'webui')
|
| -
|
| - affected_files = (f.AbsoluteLocalPath() for f in input_api.AffectedFiles())
|
| + return _RunHistogramChecks(input_api, output_api, "BadMessageReasonChrome")
|
|
|
| - would_affect_tests = [
|
| - path.join(cwd, 'PRESUBMIT.py'),
|
| - path.join(cwd, 'test_presubmit.py'),
|
| - ]
|
| - would_affect_tests += input_api.glob(path.join(cwd, 'web_dev_style', '*.py'))
|
|
|
| - if any(f for f in affected_files if f in would_affect_tests):
|
| - tests = [path.join(cwd, 'test_presubmit.py')]
|
| - results.extend(
|
| - input_api.canned_checks.RunUnitTests(input_api, output_api, tests))
|
| -
|
| - import sys
|
| - old_path = sys.path
|
| -
|
| - try:
|
| - sys.path = [cwd] + old_path
|
| - from web_dev_style import (resource_checker, css_checker, html_checker,
|
| - js_checker)
|
| -
|
| - search_dirs = (resources, webui)
|
| - def _html_css_js_resource(p):
|
| - return p.endswith(('.html', '.css', '.js')) and p.startswith(search_dirs)
|
| -
|
| - def _vulcanized_resource(p):
|
| - return p.endswith(('vulcanized.html', 'crisper.js'))
|
| -
|
| - BLACKLIST = [
|
| - 'chrome/browser/resources/pdf/index.html',
|
| - 'chrome/browser/resources/pdf/index.js'
|
| - ]
|
| - def is_resource(maybe_resource):
|
| - return (maybe_resource.LocalPath() not in BLACKLIST and
|
| - not _vulcanized_resource(maybe_resource.LocalPath()) and
|
| - _html_css_js_resource(maybe_resource.AbsoluteLocalPath()))
|
| +def CheckChangeOnUpload(input_api, output_api):
|
| + return _CommonChecks(input_api, output_api)
|
|
|
| - results.extend(resource_checker.ResourceChecker(
|
| - input_api, output_api, file_filter=is_resource).RunChecks())
|
| - results.extend(css_checker.CSSChecker(
|
| - input_api, output_api, file_filter=is_resource).RunChecks())
|
| - results.extend(html_checker.HtmlChecker(
|
| - input_api, output_api, file_filter=is_resource).RunChecks())
|
| - results.extend(js_checker.JSChecker(
|
| - input_api, output_api, file_filter=is_resource).RunChecks())
|
| - results.extend(_RunHistogramChecks(input_api, output_api,
|
| - "BadMessageReasonChrome"))
|
| - finally:
|
| - sys.path = old_path
|
|
|
| - return results
|
| +def CheckChangeOnCommit(input_api, output_api):
|
| + return _CommonChecks(input_api, output_api)
|
|
|