Commit 379d7592 authored by Demetrios Papadopoulos's avatar Demetrios Papadopoulos Committed by Commit Bot

Enable WebUI related PRESUBMIT checks under components/.

Specifically enable:
 - clang-format for JS files
 - Various HTML/CSS/JS checks including ESLint checks.
 - SVG optimization checks

Fixed: 1019312
Change-Id: I01628b5faae9ff95dc5eebefec2a0c4956ed3664
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1888151
Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
Auto-Submit: Demetrios Papadopoulos <dpapad@chromium.org>
Reviewed-by: default avatarJochen Eisinger <jochen@chromium.org>
Reviewed-by: default avatarDan Beam <dbeam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714586}
parent 20287a50
// Copyright 2019 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.
module.exports = {
'rules': {
'no-restricted-properties': 'off',
},
};
...@@ -37,6 +37,10 @@ per-file undo_strings.grdp=file://components/undo/OWNERS ...@@ -37,6 +37,10 @@ per-file undo_strings.grdp=file://components/undo/OWNERS
per-file version_ui_strings.grdp=file://components/version_ui/OWNERS per-file version_ui_strings.grdp=file://components/version_ui/OWNERS
per-file web_contents_delegate_android_strings.grdp=file://components/embedder_support/android/delegate/OWNERS per-file web_contents_delegate_android_strings.grdp=file://components/embedder_support/android/delegate/OWNERS
# For web_dev_style related changes.
per-file .eslintrc.js=file://ui/webui/PLATFORM_OWNERS
per-file PRESUBMIT.py=file://ui/webui/PLATFORM_OWNERS
# Translation artifacts: # Translation artifacts:
per-file *.xtb=file://tools/translation/TRANSLATION_OWNERS per-file *.xtb=file://tools/translation/TRANSLATION_OWNERS
......
# Copyright 2017 The Chromium Authors. All rights reserved. # Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
def _CommonChecks(input_api, output_api):
def CheckChangeOnUpload(input_api, output_api):
return _CommonChecks(input_api, output_api)
def CheckChangeOnCommit(input_api, output_api):
return _CommonChecks(input_api, output_api)
def _CheckSvgsOptimized(input_api, output_api):
results = [] results = []
try: try:
import sys import sys
old_sys_path = sys.path old_sys_path = sys.path[:]
cwd = input_api.PresubmitLocalPath() cwd = input_api.PresubmitLocalPath()
sys.path += [input_api.os_path.join(cwd, '..', '..', '..', '..', 'tools')] sys.path += [input_api.os_path.join(cwd, '..', 'tools')]
import web_dev_style.presubmit_support from resources import svgo_presubmit
results = web_dev_style.presubmit_support.CheckStyle(input_api, output_api) results += svgo_presubmit.CheckOptimized(input_api, output_api)
finally: finally:
sys.path = old_sys_path sys.path = old_sys_path
return results return results
def CheckChangeOnUpload(input_api, output_api):
return _CommonChecks(input_api, output_api)
def CheckChangeOnCommit(input_api, output_api): def _CheckWebDevStyle(input_api, output_api):
return _CommonChecks(input_api, output_api) results = []
try:
import sys
old_sys_path = sys.path[:]
cwd = input_api.PresubmitLocalPath()
sys.path += [input_api.os_path.join(cwd, '..', 'tools')]
from web_dev_style import presubmit_support
results += presubmit_support.CheckStyle(input_api, output_api)
finally:
sys.path = old_sys_path
return results
def _CommonChecks(input_api, output_api):
results = []
results += _CheckSvgsOptimized(input_api, output_api)
results += _CheckWebDevStyle(input_api, output_api)
results += input_api.canned_checks.CheckPatchFormatted(input_api, output_api,
check_js=True)
return results
...@@ -3,8 +3,15 @@ ...@@ -3,8 +3,15 @@
# found in the LICENSE file. # found in the LICENSE file.
# Ignore the following files from SVG optimization checks.
BLOCKLIST = [
# Ignore since it holds documentation comments.
"components/dom_distiller/core/images/dom_distiller_material_spinner.svg",
]
def CheckOptimized(input_api, output_api): def CheckOptimized(input_api, output_api):
file_filter = lambda f: f.LocalPath().endswith('.svg') file_filter = lambda f: f.LocalPath().endswith('.svg') and \
f.LocalPath() not in BLOCKLIST
svgs = input_api.AffectedFiles(file_filter=file_filter, include_deletes=False) svgs = input_api.AffectedFiles(file_filter=file_filter, include_deletes=False)
if not svgs: if not svgs:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment