vigetlabs / grunt-complexity

A JavaScript complexity analysis grunt task.
MIT License
221 stars 22 forks source link

Feature support event driven reporter #30

Closed davidlinse closed 10 years ago

davidlinse commented 10 years ago

Add a new reporter that broadcasts the aggregated maintainance-data over the grunt-event bus. This allows us to write decoupled reporters by listening to the provided events.

Also introduce a broadcast option which can be true|false to enable/disable the broadcasting and is false by default.

The dispatched events are:

// Event Payload for `grunt-complexity.maintainance`
{
  filepath: /path/to/instrumented/file,
  valid: true|false,
  maintainability: 123.42
}

Let me know what you think..

regards ~david

nhunzaker commented 10 years ago

This is very cool! I'm going to do some additional testing, but I really like this idea.

nhunzaker commented 10 years ago

Merged. I added a simple test to make sure events were being sent out properly. Nice work!

nhunzaker commented 10 years ago

I just published v0.2.0. Thinking more on this update, I am interested to see how we can utilize grunt's event system more. Thank you for calling it to my attention!

davidlinse commented 10 years ago

Thanks for merging.. :+1:

davidlinse commented 10 years ago

I am interested to see how we can utilize grunt's event system more.

@nhunzaker fyi: i've written a little grunt-task called grunt-complexity-updater utilizing this feature.

regards ~david