Package: cwltool / 1.0.20181217162649+dfsg-10

exclude_jshint Patch series | download
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
Author: Michael R. Crusoe <michael.crusoe@gmail.com>
Description: No javascript validation in this Debian package due to licensing issue with jshint
--- cwltool.orig/tests/test_validate_js.py
+++ cwltool/tests/test_validate_js.py
@@ -2,7 +2,6 @@
 
 from cwltool import process
 from cwltool.sandboxjs import code_fragment_to_js
-from cwltool import validate_js
 
 TEST_CWL = """
 cwlVersion: v1.0
@@ -19,43 +18,3 @@
 
 outputs: []
 """
-
-def test_get_expressions():
-    test_cwl_yaml = yaml.round_trip_load(TEST_CWL)
-    schema = process.get_schema("v1.0")[1].names["CommandLineTool"]
-
-    exprs = validate_js.get_expressions(test_cwl_yaml, schema)
-
-    assert len(exprs) == 1
-
-
-def test_validate_js_expressions(mocker):
-    test_cwl_yaml = yaml.round_trip_load(TEST_CWL)
-    schema = process.get_schema("v1.0")[1].names["CommandLineTool"]
-
-    mocker.patch("cwltool.validate_js.print_js_hint_messages")
-    validate_js.validate_js_expressions(test_cwl_yaml, schema)
-
-    assert validate_js.print_js_hint_messages.call_args is not None
-    assert len(validate_js.print_js_hint_messages.call_args[0]) > 0
-
-def test_js_hint_basic():
-    result = validate_js.jshint_js("""
-    function funcName(){
-    }
-    """, [])
-
-    assert result.errors == []
-    assert result.globals == ["funcName"]
-
-def test_js_hint_reports_invalid_js():
-    assert len(validate_js.jshint_js("<INVALID JS>").errors) > 1
-
-def test_js_hint_warn_on_es6():
-    assert len(validate_js.jshint_js(code_fragment_to_js("((() => 4)())"), []).errors) == 1
-
-def test_js_hint_error_on_undefined_name():
-    assert len(validate_js.jshint_js(code_fragment_to_js("undefined_name()")).errors) == 1
-
-def test_js_hint_set_defined_name():
-    assert len(validate_js.jshint_js(code_fragment_to_js("defined_name()"), ["defined_name"]).errors) == 0
--- cwltool.orig/cwltool/argparser.py
+++ cwltool/cwltool/argparser.py
@@ -161,11 +161,7 @@
                         "timestamps to the errors, warnings, and "
                         "notifications.")
     parser.add_argument("--js-console", action="store_true", help="Enable javascript console output")
-    parser.add_argument("--disable-js-validation", action="store_true", help="Disable javascript validation.")
-    parser.add_argument("--js-hint-options-file",
-                        type=Text,
-                        help="File of options to pass to jshint."
-                        "This includes the added option \"includewarnings\". ")
+    parser.add_argument("--disable-js-validation", help=argparse.SUPPRESS)
     dockergroup = parser.add_mutually_exclusive_group()
     dockergroup.add_argument("--user-space-docker-cmd", metavar="CMD",
                         help="(Linux/OS X only) Specify a user space docker "
--- cwltool.orig/cwltool/process.py
+++ cwltool/cwltool/process.py
@@ -45,7 +45,6 @@
 from .stdfsaccess import StdFsAccess
 from .utils import (DEFAULT_TMP_PREFIX, aslist, cmp_like_py2,
                     copytree_with_merge, onWindows, random_outdir)
-from .validate_js import validate_js_expressions
 from os import scandir  # type: ignore
 if TYPE_CHECKING:
     from .provenance import ProvenanceProfile  # pylint: disable=unused-import
@@ -531,25 +530,8 @@
             schema.make_avsc_object(
                 schema.convert_to_dict(self.outputs_record_schema), self.names)
 
-        if toolpath_object.get("class") is not None \
-                and not getdefault(loadingContext.disable_js_validation, False):
-            if loadingContext.js_hint_options_file is not None:
-                try:
-                    with open(loadingContext.js_hint_options_file) as options_file:
-                        validate_js_options = json.load(options_file)
-                except (OSError, ValueError) as err:
-                    _logger.error(
-                        "Failed to read options file %s",
-                        loadingContext.js_hint_options_file)
-                    raise err
-            else:
-                validate_js_options = None
-            if self.doc_schema is not None:
-                validate_js_expressions(
-                    cast(CommentedMap, toolpath_object),
-                    self.doc_schema.names[toolpath_object["class"]],
-                    validate_js_options)
-
+        # No javascript validation in this Debian package due to licensing
+        # issue with jshint
         dockerReq, is_req = self.get_requirement("DockerRequirement")
 
         if dockerReq is not None and "dockerOutputDirectory" in dockerReq\