OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/env python | |
2 # Copyright 2016 The Chromium Authors. All rights reserved. | |
3 # Use of this source code is governed by a BSD-style license that can be | |
4 # found in the LICENSE file. | |
5 | |
6 import os | |
7 import sys | |
8 | |
9 | |
10 _CATAPULT_PATH = os.path.abspath( | |
11 os.path.join(os.path.dirname(__file__), | |
12 os.path.pardir, os.path.pardir, os.path.pardir)) | |
13 | |
14 | |
15 _ESLINT_PATH = os.path.abspath( | |
16 os.path.join(os.path.dirname(__file__), os.path.pardir)) | |
17 | |
18 | |
19 DIRECTORIES_TO_LINT = [ | |
20 os.path.join(_CATAPULT_PATH, 'dashboard', 'dashboard'), | |
21 os.path.join(_CATAPULT_PATH, 'tracing', 'tracing') | |
22 ] | |
23 | |
24 | |
25 def _AddToPathIfNeeded(path): | |
26 if path not in sys.path: | |
27 sys.path.insert(0, path) | |
28 | |
29 | |
30 if __name__ == '__main__': | |
charliea (OOO until 10-5)
2016/09/23 13:06:35
Is there a good place to provide usage information
nednguyen
2016/09/23 13:16:04
Best is to use argparse & make commandline flag in
| |
31 _AddToPathIfNeeded(_ESLINT_PATH) | |
32 import eslint | |
33 | |
34 if len(sys.argv) == 1: | |
35 print eslint.RunEslintOnDirs(DIRECTORIES_TO_LINT) | |
36 else: | |
37 print eslint.RunEslint(sys.argv[1:]) | |
OLD | NEW |