-
Notifications
You must be signed in to change notification settings - Fork 371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
An option for hy to *only* check syntax #689
Comments
Yeah that sounds awesome! :D Perhaps also machine readable lexer errors! On Thu, Nov 20, 2014 at 2:02 PM, Koz Ross notifications@github.com wrote:
:wq |
If you just want to check for syntatical/macro errors:
From then on, you can just do:
|
@kirbyfan64 This will only check syntax - not invalid imports, undefined functions, etc. I guess that stuff is all done at runtime, which basically means that I'd have to write a linter for Hy if I wanted that stuff checked. Well, I guess I can do that - in Hy! I have three ideas for names: |
I would like to have error checking for hy with flycheck as well, so I tried to make pylint work with hy: This seems to actually work. Pylint just uses an python ast, and it takes one created by hy just fine. Some of the warnings don't make much sense though and I have not spend a lot of time playing with different (and more complex) hy sources yet. Basic things like getting told when I use an undefined variable or unused arguments and stuff like that are already a huge success for me. |
Is there anything done on this part? It's marked as |
No, nobody has worked on this since. Presumably @berkerpeksag marked it |
Beware that once we have reader macros, which seems likely to happen (#2242), syntactic correctness will become Turing-undecidable. That is, you'll have to compile and macroexpand everything in order to check the syntax, which can involve running arbitrary code. Perl has a similar problem due to |
Yeah, considering that issue, this feature would probably not be very helpful, and it would be dangerous because people would probably use it not realizing that it can run arbitrary code. You could implement an approximation of some sort, like checking that code with no reader macros is syntactically correct in terms of what can be analyzed statically, but that's probably something best implemented as an external tool than a feature of Hy itself. |
I'm writing a syntax checker for Hy in Flycheck at the moment, and have hit a bit of a stumbling block. At the moment, the only (easy...) way to syntax-check Hy source code is to pump it through
hy
and hope it executes. This isn't very desirable in a Flycheck checker, as it means executing (again and again) code that may take a long time to run or have side effects we don't want.Would it be possible to add a flag to
hy
(I suggest-c
) which only checks it for syntactic validity? It would spew the same errors ashy
does now if the code isn't syntactically valid (or it can't find the module or whatever), and do nothing but return success otherwise?The text was updated successfully, but these errors were encountered: