-
Notifications
You must be signed in to change notification settings - Fork 9
/
xsslint_config.py
57 lines (43 loc) · 1.46 KB
/
xsslint_config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# xsslint config module for edx-platform
import os
import sys
# Temporarily add xsslint to sys.path so that we can import from it. This won't be necessary once
# xsslint is moved out of edx-platform.
scripts_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(scripts_dir, 'xsslint'))
from xsslint.linters import JavaScriptLinter, MakoTemplateLinter, PythonLinter, UnderscoreTemplateLinter
# Define the directories that should be ignored by the script.
SKIP_DIRS = (
'.git',
'.pycharm_helpers',
'common/static/xmodule/modules',
'common/static/bundles',
'perf_tests',
'node_modules',
'reports/diff_quality',
'scripts/xsslint',
'spec',
'test_root',
'vendor',
)
UNDERSCORE_SKIP_DIRS = SKIP_DIRS + ('test',)
UNDERSCORE_LINTER = UnderscoreTemplateLinter(
skip_dirs=UNDERSCORE_SKIP_DIRS
)
JAVASCRIPT_SKIP_DIRS = SKIP_DIRS + ('i18n',)
JAVASCRIPT_LINTER = JavaScriptLinter(
underscore_linter=UNDERSCORE_LINTER,
javascript_skip_dirs=JAVASCRIPT_SKIP_DIRS,
)
PYTHON_SKIP_DIRS = SKIP_DIRS + ('tests', 'test/acceptance')
PYTHON_LINTER = PythonLinter(
skip_dirs=PYTHON_SKIP_DIRS
)
MAKO_SKIP_DIRS = SKIP_DIRS
MAKO_LINTER = MakoTemplateLinter(
javascript_linter=JAVASCRIPT_LINTER,
python_linter=PYTHON_LINTER,
skip_dirs=MAKO_SKIP_DIRS
)
# (Required) Define the linters (code-checkers) that should be run by the script.
LINTERS = (MAKO_LINTER, UNDERSCORE_LINTER, JAVASCRIPT_LINTER, PYTHON_LINTER)