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

Side by Side Diff: chrome/app/policy/PRESUBMIT.py

Issue 6299001: Syntax checker for policy_templates.json (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/app/policy
Patch Set: address more comments Created 9 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 # If this presubmit check fails or misbehaves, please complain to
6 # gfeher@chromium.org or jkummerow@chromium.org.
7
8 import sys
9 import traceback
M-A Ruel 2011/01/18 16:06:23 pelase remove this import, it's not used.
Jakob Kummerow 2011/01/18 16:33:54 Done. (Leftover from an earlier version. Should've
10
11
12 def _CommonChecks(input_api, output_api):
13 filename = 'policy_templates.json'
14 results = []
15 old_sys_path = sys.path
16 try:
17 sys.path = [input_api.PresubmitLocalPath()] + sys.path
18 for f in input_api.AffectedFiles():
M-A Ruel 2011/01/18 16:06:23 nit: Sorry for the round-trips but what about chan
Jakob Kummerow 2011/01/18 16:33:54 No problem at all. I'm always happy to learn how t
19 if (f.AbsoluteLocalPath() ==
20 input_api.os_path.join(input_api.PresubmitLocalPath(), filename)):
21 # Optimization: only load this when it's needed.
22 import syntax_check_policy_template_json
23 checker = syntax_check_policy_template_json.PolicyTemplateChecker()
24 result = checker.Run([], f.AbsoluteLocalPath())
25 if result > 0:
26 results.append(output_api.PresubmitError(
27 'Syntax error(s) in file:', [f]))
28 finally:
29 sys.path = old_sys_path
30 return results
31
32
33 def CheckChangeOnUpload(input_api, output_api):
34 return _CommonChecks(input_api, output_api)
35
36
37 def CheckChangeOnCommit(input_api, output_api):
38 return _CommonChecks(input_api, output_api)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698