Or check out Shill. It may just be what you want. — Matthias
> On Nov 26, 2016, at 3:45 PM, Alexis King <[email protected]> wrote: > > Many of the other answers here are good, but I want to try and give a > couple more options and a little more context. > > First of all, in Racket, the phrase “syntactically correct” is a little > bit vague. It could mean that a program is successfully parsed from text > to s-expressions, which is the reader step, or it could mean that > macroexpansion completes successfully. The former definition is the more > traditional definition of “syntactically correct”, but being able to > parse an AST means little in a language where the code effectively is > the AST. For that reason, something like (define) is obviously a “syntax > error”, but it’s perfectly valid from the reader’s point of view. > > So the question is, which of the two things do you want to check? > Obviously, checking if macros properly expand is a strictly stronger > check than checking if the program is properly read. > > - If you want to check that a program is properly read, you can use > `raco read` from the command line, or you can use `read` in > combination with with-module-reading-parameterization from > syntax/modread to achieve something similar programatically. > > - If you want to check that a program properly macroexpands, you can > use `raco expand` from the command line, or you can use `expand` on > the value produced by the previous step after setting > current-namespace to (make-base-namespace). > > However, be aware of the implications of both of these things! > Performing macroexpansion on a program can have arbitrary side-effects. > It’s perfectly possible to write a macro that will open an HTTP > connection and send all your private data over the wire. For this > reason, macroexpansion is no safer than actually running the program, so > you should do it in a sandbox if you are running arbitrary > user-submitted code. > > In contrast, the reader step seems safe, but it’s actually not. Due to > the existence of #lang and #reader, users can supply arbitrary readers > for their programs, which can also run arbitrary code. If you do not > need to support arbitrary #lang languages, you could set > read-accept-reader and read-accept-lang to #f, then do the reading > yourself, and that would be safe, but then you can’t use > with-module-reading-parameterization mentioned above. > > If you are going to run either of the two steps above using the > command-line tools, I would recommend that you run them inside a virtual > machine with no network access or access to the host filesystem. You > could also use the programmatic approach and use racket/sandbox, which > allows restricting what programs can do, but I don’t claim to know how > strong the security guarantees are that racket/sandbox provides. > > (Of course, if you’re running arbitrary code, anyway, then you are > probably aware of those things. I just want to make it clear that using > this as a “safe precheck” is not a valid assumption for future readers > who might stumble upon this thread.) > > Alexis > >> On Nov 25, 2016, at 17:28, David Storrs <[email protected]> wrote: >> >> As part of my pre-checkin test suite I'd like to be able to check that all >> files are syntactically correct, but I don't want to actually execute them >> because, e.g. executing 'server.rkt' would start the server and I don't want >> that. Is there a way to do this? Nothing I see under 'raco help' or the >> racket docs suggests a solution. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Racket Users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

