comparison env/lib/python3.9/site-packages/cwltool/jshint/jshint_wrapper.js @ 0:4f3585e2f14b draft default tip

"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author shellac
date Mon, 22 Mar 2021 18:12:50 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4f3585e2f14b
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 }