diff --git a/scripts/xsslint_config.py b/scripts/xsslint_config.py index 8c244dca54..886f920fee 100644 --- a/scripts/xsslint_config.py +++ b/scripts/xsslint_config.py @@ -8,8 +8,12 @@ import sys # 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 # pylint: disable=import-error,wrong-import-position +# pylint: disable=import-error,wrong-import-position +from xsslint.linters import ( + JavaScriptLinter, MakoTemplateLinter, + PythonLinter, UnderscoreTemplateLinter, + DjangoTemplateLinter +) # Define the directories that should be ignored by the script. SKIP_DIRS = ( @@ -53,6 +57,10 @@ MAKO_LINTER = MakoTemplateLinter( skip_dirs=MAKO_SKIP_DIRS ) +DJANGO_SKIP_DIRS = SKIP_DIRS +DJANGO_LINTER = DjangoTemplateLinter( + skip_dirs=DJANGO_SKIP_DIRS +) # (Required) Define the linters (code-checkers) that should be run by the script. -LINTERS = (MAKO_LINTER, UNDERSCORE_LINTER, JAVASCRIPT_LINTER, PYTHON_LINTER) +LINTERS = (DJANGO_LINTER, MAKO_LINTER, UNDERSCORE_LINTER, JAVASCRIPT_LINTER, PYTHON_LINTER) diff --git a/scripts/xsslint_thresholds.json b/scripts/xsslint_thresholds.json index 2e65c783c6..bcb296fea7 100644 --- a/scripts/xsslint_thresholds.json +++ b/scripts/xsslint_thresholds.json @@ -1,32 +1,41 @@ { "rules": { - "javascript-concat-html": 160, + "javascript-concat-html": 137, "javascript-escape": 7, - "javascript-interpolate": 26, + "javascript-interpolate": 23, "javascript-jquery-append": 68, - "javascript-jquery-html": 166, + "javascript-jquery-html": 139, "javascript-jquery-insert-into-target": 18, "javascript-jquery-insertion": 19, - "javascript-jquery-prepend": 7, + "javascript-jquery-prepend": 6, "mako-html-entities": 0, "mako-invalid-html-filter": 7, - "mako-invalid-js-filter": 107, + "mako-invalid-js-filter": 59, "mako-js-html-string": 0, "mako-js-missing-quotes": 0, - "mako-missing-default": 139, + "mako-missing-default": 83, "mako-multiple-page-tags": 0, "mako-unknown-context": 0, "mako-unparseable-expression": 0, "mako-unwanted-html-filter": 0, "python-close-before-format": 0, - "python-concat-html": 3, - "python-custom-escape": 7, - "python-deprecated-display-name": 12, - "python-interpolate-html": 30, + "python-concat-html": 0, + "python-custom-escape": 5, + "python-deprecated-display-name": 4, + "python-interpolate-html": 26, "python-parse-error": 0, "python-requires-html-or-text": 0, - "python-wrap-html": 129, - "underscore-not-escaped": 493 + "python-wrap-html": 68, + "underscore-not-escaped": 437, + "django-trans-missing-escape": 18, + "django-trans-invalid-escape-filter": 0, + "django-trans-escape-variable-mismatch": 0, + "django-blocktrans-missing-escape-filter": 12, + "django-blocktrans-parse-error": 0, + "django-blocktrans-escape-filter-parse-error": 0, + "django-html-interpolation-missing-safe-filter": 0, + "django-html-interpolation-missing": 1, + "django-html-interpolation-invalid-tag": 0 }, - "total": 1398 + "total": 1137 }