OLD | NEW |
---|---|
(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 os | |
9 import sys | |
10 import traceback | |
11 | |
12 | |
13 def _CommonChecks(input_api, output_api): | |
14 filename = 'policy_templates.json' | |
15 results = [] | |
16 for f in input_api.AffectedFiles(): | |
17 if f.AbsoluteLocalPath() == os.path.join(input_api.PresubmitLocalPath(), | |
M-A Ruel
2011/01/18 13:52:03
input_api.os_path.join(...
Jakob Kummerow
2011/01/18 15:02:36
Done.
| |
18 filename): | |
19 sys.path.append(input_api.PresubmitLocalPath()) | |
M-A Ruel
2011/01/18 13:52:03
Don't do that, it affects all following presubmit
Jakob Kummerow
2011/01/18 15:02:36
Done.
| |
20 # Optimization: only load this when it's needed. | |
21 import syntax_check_policy_template_json | |
22 checker = syntax_check_policy_template_json.PolicyTemplateChecker() | |
23 result = checker.Run([], f.AbsoluteLocalPath()) | |
24 if result > 0: | |
25 results.append(output_api.PresubmitError( | |
26 'Syntax error(s) in file:', [f])) | |
27 return results | |
28 | |
29 | |
30 def CheckChangeOnUpload(input_api, output_api): | |
31 return _CommonChecks(input_api, output_api) | |
32 | |
33 | |
34 def CheckChangeOnCommit(input_api, output_api): | |
35 return _CommonChecks(input_api, output_api) | |
OLD | NEW |