diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/env/lib/python3.9/site-packages/cwltool/jshint/jshint_wrapper.js	Mon Mar 22 18:12:50 2021 +0000
@@ -0,0 +1,47 @@
+"use strict";
+// set a global object, in order for jshint to work
+var global = this;
+
+function validateJS(input) {
+  var jshintGlobalsObj = {};
+  input.globals.forEach(function (global) {
+    jshintGlobalsObj[global] = true;
+  })
+  var includewarnings;
+
+  if (input.options.includewarnings !== undefined) {
+    includewarnings = input.options.includewarnings;
+    delete input.options.includewarnings;
+  }
+
+  JSHINT(
+    input.code,
+    input.options,
+    jshintGlobalsObj
+  )
+
+  var jshintData = JSHINT.data();
+  if (jshintData.errors !== undefined) {
+    if (includewarnings !== undefined) {
+      jshintData.errors = jshintData.errors.filter(function (error) {
+        return includewarnings.indexOf(error.code) !== -1 || error.code[0] == "E";
+      })
+    }
+
+    jshintData.errors.forEach(function (error) {
+      if (error.code == "W104" || error.code == "W119") {
+        if (error.code == "W104"){
+          var jslint_suffix = " (use 'esversion: 6') or Mozilla JS extensions (use moz)."
+        }
+        else{
+          var jslint_suffix = " (use 'esversion: 6')"
+        }
+
+        error.reason = error.reason.slice(0, -jslint_suffix.length - 1) +
+          ". CWL only supports ES5.1";
+      }
+    })
+  }
+
+  return jshintData;
+}