broadinstitute/wdltool

Highlight not working on valid tools

anton-khodak opened this issue · 3 comments

I use wdltool to parse descriptions from the main repository, for instance, this one and this . Both descriptions have valid syntax (validate and parse run smoothly). However, when I run highlight on either of them, I get the following error:

$ java -jar ~/Downloads/wdltool-0.8.jar highlight "/media/anton/ECFA959BFA95631E/Programming/wdl2cwl/ValidateBamsWf_170107.wdl" console

Exception in thread "main" scala.MatchError: [Declaration type=Array[File] name=validation_reports expr=Some(ValidateBAM.validation_report)] (of class wdl4s.WorkflowOutput)
       at wdl4s.formatter.SyntaxFormatter.wdl4s$formatter$SyntaxFormatter$$formatScope(SyntaxFormatter.scala:188)
       at wdl4s.formatter.SyntaxFormatter$$anonfun$4.applyOrElse(SyntaxFormatter.scala:153)
       at wdl4s.formatter.SyntaxFormatter$$anonfun$4.applyOrElse(SyntaxFormatter.scala:153)
       at scala.PartialFunction$$anonfun$runWith$1.apply(PartialFunction.scala:141)
       at scala.PartialFunction$$anonfun$runWith$1.apply(PartialFunction.scala:140)
       at scala.collection.Iterator$class.foreach(Iterator.scala:893)
       at scala.collection.AbstractIterator.foreach(Iterator.scala:1336)
       at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
       at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
       at scala.collection.TraversableLike$class.collect(TraversableLike.scala:271)
       at scala.collection.AbstractTraversable.collect(Traversable.scala:104)
       at wdl4s.formatter.SyntaxFormatter.wdl4s$formatter$SyntaxFormatter$$formatWorkflow(SyntaxFormatter.scala:153)
       at wdl4s.formatter.SyntaxFormatter$$anonfun$2.applyOrElse(SyntaxFormatter.scala:73)
       at wdl4s.formatter.SyntaxFormatter$$anonfun$2.applyOrElse(SyntaxFormatter.scala:73)
       at scala.PartialFunction$$anonfun$runWith$1.apply(PartialFunction.scala:141)
       at scala.PartialFunction$$anonfun$runWith$1.apply(PartialFunction.scala:140)
       at scala.collection.Iterator$class.foreach(Iterator.scala:893)
       at scala.collection.AbstractIterator.foreach(Iterator.scala:1336)
       at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
       at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
       at scala.collection.TraversableLike$class.collect(TraversableLike.scala:271)
       at scala.collection.AbstractTraversable.collect(Traversable.scala:104)
       at wdl4s.formatter.SyntaxFormatter.format(SyntaxFormatter.scala:73)
       at wdltool.Main$$anonfun$highlight$2$$anonfun$apply$2.apply(Main.scala:52)
       at wdltool.Main$$anonfun$highlight$2$$anonfun$apply$2.apply(Main.scala:50)
       at wdltool.Main$.wdltool$Main$$loadWdl(Main.scala:98)
       at wdltool.Main$$anonfun$highlight$2.apply(Main.scala:50)
       at wdltool.Main$$anonfun$highlight$2.apply(Main.scala:50)
       at wdltool.Main$.continueIf(Main.scala:94)
       at wdltool.Main$.highlight(Main.scala:49)
       at wdltool.Main$.dispatchCommand(Main.scala:34)
       at wdltool.Main$.delayedEndpoint$wdltool$Main$1(Main.scala:151)
       at wdltool.Main$delayedInit$body.apply(Main.scala:12)
       at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
       at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
       at scala.App$$anonfun$main$1.apply(App.scala:76)
       at scala.App$$anonfun$main$1.apply(App.scala:76)
       at scala.collection.immutable.List.foreach(List.scala:381)
       at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
       at scala.App$class.main(App.scala:76)
       at wdltool.Main$.main(Main.scala:12)
       at wdltool.Main.main(Main.scala)

@anton-khodak Thanks for noticing this! I didn't realize people actually used the highlighting, that's useful info in and of itself :)

This looks to be a case where our unit test was overly simplistic. I have a fix but it'll likely be a day or two before it's in place.

@geoffjentry I wanted to use highlighting in secondary purposes, as a way of exporting WDL description in a parsable format other than AST, so maybe it is not that indicative. It is not blocking me, please take your time