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

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 import os
6 import sys
7 import traceback
8
9
10 def _CommonChecks(input_api, output_api):
11 try:
12 filename = 'policy_templates.json'
13 results = []
14 for f in input_api.AffectedFiles():
15 if f.AbsoluteLocalPath() == os.path.join(input_api.PresubmitLocalPath(),
16 filename):
17 sys.path.append(input_api.PresubmitLocalPath())
18 import syntax_check_policy_template_json
19 checker = syntax_check_policy_template_json.PolicyTemplateChecker()
20 result = checker.Run([], f.AbsoluteLocalPath())
21 if result > 0:
22 results.append(output_api.PresubmitError(
23 'Syntax error(s) in file:', [f]))
24 return results
25 except:
26 print "exception :-("
27 traceback.print_exc(file=sys.stdout)
28 return results
29
30
31 def CheckChangeOnUpload(input_api, output_api):
32 return _CommonChecks(input_api, output_api)
33
34
35 def CheckChangeOnCommit(input_api, output_api):
36 return _CommonChecks(input_api, output_api)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698