Please correct me where I'm wrong (still learning Gulp, Streams, etc.) I'd like to create a custom reporter for my gulp-jscs
results. For example, let's say I have 3 files in my gulp.src()
stream. To my knowledge, each is piped one at a time through jscs
, which attaches a .jscs
object onto the file
with its results, one such variable in that object is .errorCount
.
What I'd like to do is have a variable I create, ie: maxErrors
which I set to, say 5
. Since we're processing 3 files, let's say the first file passes with 0 errors, but the next has 3 errors. I don't want to prematurely stop processing since the maxErrors
tally has not been reached (3/5 currently). So it should continue to process the next file which lets say has 3 errors as well, putting us over our max, so that we interrupt jscs
from continuing to process more files and instead fail out and then let our custom reporter function gain access to the files that have been processed so I can look at their .jscs
objects and customize some output.
My problem here is that I don't understand the docs when they say: .pipe(jscs.reporter('name-of-reporter'))
How does a string value invoke my reporter (which currently exists as a function I've imported called libs.reporters.myJSCSReporter
. I know pipe()
expects Stream
objects, so I can't just put a function
in the .pipe()
call.
I hope I've explained myself well enough (please ask for clarifications otherwise).