comparison env/lib/python3.7/site-packages/cwltool/jshint/jshint_wrapper.js @ 5:9b1c78e6ba9c draft default tip

"planemo upload commit 6c0a8142489327ece472c84e558c47da711a9142"
author shellac
date Mon, 01 Jun 2020 08:59:25 -0400
parents 79f47841a781
children
comparison
equal deleted inserted replaced
4:79f47841a781 5:9b1c78e6ba9c
1 "use strict";
2 // set a global object, in order for jshint to work
3 var global = this;
4
5 function validateJS(input) {
6 var jshintGlobalsObj = {};
7 input.globals.forEach(function (global) {
8 jshintGlobalsObj[global] = true;
9 })
10 var includewarnings;
11
12 if (input.options.includewarnings !== undefined) {
13 includewarnings = input.options.includewarnings;
14 delete input.options.includewarnings;
15 }
16
17 JSHINT(
18 input.code,
19 input.options,
20 jshintGlobalsObj
21 )
22
23 var jshintData = JSHINT.data();
24 if (jshintData.errors !== undefined) {
25 if (includewarnings !== undefined) {
26 jshintData.errors = jshintData.errors.filter(function (error) {
27 return includewarnings.indexOf(error.code) !== -1 || error.code[0] == "E";
28 })
29 }
30
31 jshintData.errors.forEach(function (error) {
32 if (error.code == "W104" || error.code == "W119") {
33 if (error.code == "W104"){
34 var jslint_suffix = " (use 'esversion: 6') or Mozilla JS extensions (use moz)."
35 }
36 else{
37 var jslint_suffix = " (use 'esversion: 6')"
38 }
39
40 error.reason = error.reason.slice(0, -jslint_suffix.length - 1) +
41 ". CWL only supports ES5.1";
42 }
43 })
44 }
45
46 return jshintData;
47 }