diff venv/lib/python2.7/site-packages/planemo/lint.py @ 0:d67268158946 draft

planemo upload commit a3f181f5f126803c654b3a66dd4e83a48f7e203b
author bcclaywell
date Mon, 12 Oct 2015 17:43:33 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/venv/lib/python2.7/site-packages/planemo/lint.py	Mon Oct 12 17:43:33 2015 -0400
@@ -0,0 +1,15 @@
+import os
+
+from planemo.xml import validation
+
+
+def lint_xsd(lint_ctx, schema_path, path):
+    name = os.path.basename(path)
+    validator = validation.get_validator(require=True)
+    validation_result = validator.validate(schema_path, path)
+    if not validation_result.passed:
+        msg = "Invalid %s found. Errors [%s]"
+        msg = msg % (name, validation_result.output)
+        lint_ctx.error(msg)
+    else:
+        lint_ctx.info("%s found and appears to be valid XML" % name)