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

Unified Diff: chrome/browser/resources/PRESUBMIT.py

Issue 9923005: [WebUI] Fix rest of CSS style nits so I can turn on CSS checker. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: re-enable rule for nduca Created 8 years, 9 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
Index: chrome/browser/resources/PRESUBMIT.py
diff --git a/chrome/browser/resources/PRESUBMIT.py b/chrome/browser/resources/PRESUBMIT.py
index 82a6184ff070db348e7bf87f4b9cb2d9e6ee1ffd..3835a5563278c4b3c0725fa564ac6c41ceea4bd1 100644
--- a/chrome/browser/resources/PRESUBMIT.py
+++ b/chrome/browser/resources/PRESUBMIT.py
@@ -44,6 +44,12 @@ def _CommonChecks(input_api, output_api):
sys.path.insert(0, resources)
from web_dev_style import css_checker, js_checker
+ # NOTE: This presubmit only scans affected files in this directory or in
+ # subdirectories, that why we don't need to check for .startswith(resources)
+ # here.
+ def is_resource(f):
+ return f.LocalPath().endswith(('.css', '.html', '.js'))
+
# TODO(dbeam): Remove this directory filter eventually when ready.
dirs = (
path.join(resources, 'extensions'),
@@ -53,14 +59,13 @@ def _CommonChecks(input_api, output_api):
path.join(resources, 'options2'),
path.join(resources, 'uber'),
)
- def file_filter(affected_file):
- f = affected_file.AbsoluteLocalPath()
- return (f.startswith(dirs) and f.endswith(('.css', '.html', '.js')))
+ def certain_dirs(f):
+ return is_resource(f) and f.AbsoluteLocalPath().startswith(dirs)
results.extend(css_checker.CSSChecker(input_api, output_api,
- file_filter=file_filter).RunChecks())
+ file_filter=is_resource).RunChecks())
results.extend(js_checker.JSChecker(input_api, output_api,
- file_filter=file_filter).RunChecks())
+ file_filter=certain_dirs).RunChecks())
finally:
sys.path = old_path

Powered by Google App Engine
This is Rietveld 408576698