Request: Add support for CoffeeScript
daniellmb opened this issue · 10 comments
I'd love to see support for CoffeeScript. A simple way to implement it would be to take files ending in .coffee
, .litcoffee
, .coffee.md
and compiling them to javascript so they can be tested for complexity using exiting checks.
We'd love to see that as well. Unfortunately complexityReport, to our knowledge, doesn't support CoffeeScript. We'd need to explore other options.
One option that looks promising is coffeelint, do you know of any other code analysis tools for CS that might provide similar metrics to compexityReport?
I'd love to see this happen.
I am using coffeelint but it is not as robust as complexityReport, that is why I suggested instead of trying to rewrite all that into CS, perhaps it could be reused by simply compiling CS to JS first. I haven't tried it but it could be a viable option.
In our experience we've found, while possible, it's hard to work with the compiled JS, it tends to give very flawed metrics. I'll hack on it and see what I can come up with.
sweet, yeah and all the anonymous functions in CoffeeScript don't help either.
Hey @nhunzaker, great tool! I tried the tool with compiled JS, and it still give me good insights on code that was too complex.
👍
+1
I got it to work in gulp-complexity quite easily; my changes were rejected. So I should start an independent fork. https://github.com/nmccready/gulp-complexity
@nmccready cool! Would love to backport this to grunt-complexity. Do you just feed the coffeescript AST into escomplex?
@nhunzaker I think the brunt of the work comes from this lib. https://github.com/jared-stilwell/escomplex-coffee