Linting Haxe (for SublimeLinter)

213 views
Skip to first unread message

shvfn

unread,
Dec 29, 2012, 1:56:39 PM12/29/12
to haxe...@googlegroups.com
Hi everybody,

I have a question about 'linting' Haxe. I use SublimeText2 as text editor and want to try to configure a plugin called SublimeLinter to work with Haxe. The problem is: I have only a very vague idea of what to do, but perhaps I can figure something out with your help.

So, the first question is: is there a linter for Haxe?

Best,
Stefan

Justin Donaldson

unread,
Dec 29, 2012, 4:03:56 PM12/29/12
to haxe...@googlegroups.com
I don't believe so, but it would be a great addition to a dev toolkit.  I know there's a version for flex (flexpmd) that is based on the java pmd.  That seems like the most polished linter that is closest to Haxe syntax.

The compiler already does a number of sensible things for cleaning up unused methods, variables, etc. in code using  the --dead-code-elimination flag.  But, it would be nice to have the same power to clean up the actual code, instead of just the compiled output.  

Some linting jobs are easy enough to implement with basic text processing (unused imports), but others are going to require syntax/scope-level awareness.  Since the Haxe syntax is fairly complicated (macros, @:keep, etc.), this is going to be difficult.

Finally, linters are often "opinionated" in terms of what the author thinks code should look like.  The best example of this is jslint.  I won't link to the discussions on it, they're not hard to find.  So, the more optional flags/configs for lint checking, the better imho.

-Justin





--
blog: http://www.scwn.net
twitter: sudojudo

shvfn

unread,
Dec 30, 2012, 2:46:50 AM12/30/12
to haxe...@googlegroups.com
Ok, I think without a working linter, I'm done with this idea... that's way out of my league. :)

Thanks Justin!

Simon Krajewski

unread,
Dec 30, 2012, 5:35:52 AM12/30/12
to haxe...@googlegroups.com
Am 29.12.2012 22:03, schrieb Justin Donaldson:
> Some linting jobs are easy enough to implement with basic text
> processing (unused imports),

I think enum constructors would give you trouble there because their
usage is type-dependent in some contexts.

> but others are going to require syntax/scope-level awareness. Since
> the Haxe syntax is fairly complicated (macros, @:keep, etc.), this is
> going to be difficult.

Indeed. It won't work with a pure syntax analysis, but an algorithm like
DCE that works on the typed AST could be modified for that purpose.

Simon
Reply all
Reply to author
Forward
0 new messages