XQLint - XQuery & JSONiq linter

124 views
Skip to first unread message

William Candillon

unread,
Mar 22, 2014, 11:26:31 AM3/22/14
to jsoniq
Hello,

Here's a cli tool you can use to check your queries for warnings and errors:
https://github.com/wcandillon/xqlint

Kind regards,

William

her...@stamm-wilbrandt.de

unread,
Mar 26, 2014, 1:33:47 PM3/26/14
to jso...@googlegroups.com

Cool tool!

"lint" warnings for my XQuery or JSONiq scripts are typically either "Unexpected Indentation" or "Trailing whitespace".
But option "-s no" allows to skip style checking, see below screenshot.

And "xqlint highlight ..." can be "misused" to highlight JSON files as well, see bottom:


Hermann Stamm-Wilbrandt.

William Candillon

unread,
Mar 26, 2014, 1:37:12 PM3/26/14
to jsoniq
Cool!
In 0.0.6, --style-check will be no by default.
Maybe it was too harsh to activate it by default ;-)


--
You received this message because you are subscribed to the Google Groups "JSONiq" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jsoniq+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

her...@stamm-wilbrandt.de

unread,
Mar 26, 2014, 3:36:09 PM3/26/14
to jso...@googlegroups.com
Just tried "xqlint lint -s no ..." with the 6 featured queries on try.zorba.io:
http://try.zorba.io/featured

The try/catch query results in error message:
$ xqlint lint -s no tc.xq
/home/stammw/tc.xq
[1:0] [W02] "http://www.w3.org/2005/xqt-errors" already bound to the "err" prefix
declare namespace err="http://www.w3.org/2005/xqt-errors";
Linted 1 files. Found 0 errors and 1 warnings.
$

And try.zorba.io complains if first line is commented out ...
http://try.zorba.io/queries/xquery/Nx4rVAQL9aQ9bDCQrBKdyr%2BRbok%3D


Hermann Stamm-Wilbrandt.

William Candillon

unread,
Mar 26, 2014, 6:06:37 PM3/26/14
to jsoniq
Hi Hermann,

It's actually a bug in try.zorba.io not xqlint (we use eval which has
a different static context).
The default static context is configured to be identical to one
configured on the http://28.io platform.
So the warning thrown in the try catch example is accurate if you run
the query on 28.io.

If you run a different processor, you will have to set the static
context programatically in the XQLint object.
It is likely that the xqlint cli will allow to specify static context
options in a file (something like .xqlintrc) but it is not planned
yet. However Pull requests are welcomed ;-)

Kind regards,

William
Reply all
Reply to author
Forward
0 new messages