grunt-complexity icon indicating copy to clipboard operation
grunt-complexity copied to clipboard

Request: Add support for CoffeeScript

Open daniellmb opened this issue 11 years ago • 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.

daniellmb avatar Sep 11 '13 19:09 daniellmb

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.

nhunzaker avatar Sep 11 '13 20:09 nhunzaker

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.

daniellmb avatar Sep 11 '13 20:09 daniellmb

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.

nhunzaker avatar Sep 11 '13 20:09 nhunzaker

sweet, yeah and all the anonymous functions in CoffeeScript don't help either.

daniellmb avatar Sep 11 '13 21:09 daniellmb

Hey @nhunzaker, great tool! I tried the tool with compiled JS, and it still give me good insights on code that was too complex.

leonelgalan avatar Dec 05 '13 15:12 leonelgalan

:+1:

nmccready avatar Apr 03 '15 03:04 nmccready

+1

abarnwell avatar Nov 18 '15 14:11 abarnwell

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 avatar Nov 18 '15 15:11 nmccready

@nmccready cool! Would love to backport this to grunt-complexity. Do you just feed the coffeescript AST into escomplex?

nhunzaker avatar Nov 18 '15 21:11 nhunzaker

@nhunzaker I think the brunt of the work comes from this lib. https://github.com/jared-stilwell/escomplex-coffee

nmccready avatar Nov 19 '15 00:11 nmccready