-
Notifications
You must be signed in to change notification settings - Fork 11
Add ability to write reports to file #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is from me trying to mock out console... Does nothing that I can tell, as we manually restore the stub
|
👍 |
1. Second argumentAs proposed in this pull request. gulp.task('lint', function() {
gulp.files('lib/*.css')
.pipe(csslint())
.pipe(csslint.reporter('junit-xml', 'csslint-junit-report.xml'));2. Separate reportersTo add this ability to gulp.src('./lib/*.js')
.pipe(jshint())
.pipe(jshint.reporter('gulp-jshint-file-reporter', {
filename: __dirname + '/jshint-output.log'
}));3. Plugin optionIn gulp.src(['**/*.scss'])
.pipe(scsslint({
'reporterOutput': 'scssReport.json'
}));4. Capture stdoutThere is a gulp.src('src/js/*.js')
.pipe(jshint())
.pipe(logCapture.start(console, 'log'))
.pipe(jshint.reporter('jslint_xml'))
.pipe(logCapture.stop('xml'))
.pipe(gulp.dest('lint-reports')); |
|
1: In #29 an options-hash will be added as a second argument (should have been added in #21...), so we could piggy-back on that |
|
@SimenB, check out how reporters work in I talked with @phated, and another option is to always send a File down stream, and make printing configurable (on by default). Using the options hash as a second argument, as you proposed, this would end up being something like: gulp.task('lint', function() {
gulp.files('lib/*.css')
.pipe(csslint())
.pipe(csslint.reporter('junit-xml', { stdout: false })) // don't print to stdout
.pipe(gulp.dest('results/'));I suppose it's possible that we won't want to send the report downstream, but instead the files themselves... Is that a valid use case? |
|
The messes up linting files on the way to a final destinal (love those movies...), though, unless involving some fancy filtering and stuff. How about if |
|
Write to disk reporters are against gulp guidelines. You are not supposed to touch the file system outside src/dest. There are modules like gulp-filter and gulp-if for the scenarios you mentioned. |
|
Would it look something like this? I can't wrap my head around how to use gulp.task('css', function () {
var cssFiles = gulp.src('src/styles/*.css');
cssFiles
.pipe(clone()) // gulp-clone
.pipe(csslint())
.pipe(csslint.reporter('junit-xml', { stdout: false }))
.pipe(gulp.dest('junit-report.xml'));
return cssFiles
.pipe(/*keep on piping the css-files, doing concat or whatever*/);
});EDIT: I suppose we could ADD the file to the stream, then use gulp.task('css', function () {
var filter = gulpFilter('!csslint-report.xml');
return gulp.src('src/styles/*.css');
.pipe(csslint())
.pipe(csslint.reporter('junit-xml', { stdout: false, fileName: 'csslint-report.xml' }))
.pipe(filter())
.pipe(gulp.dest('results/'))
.pipe(filter.restore())
.pipe(/*keep on piping the css-files, doing concat or whatever*/);
}); |
|
We have this need as well. An implementation similar to idea 1 that @lazd proposed on Aug 18 above would both allow the user to capture the output of any reporter, and allow more than one reporter to be chained like below: How can I help with this request? |
|
@adamkingit Nag on me to complete #36 which includes the possibility to write to file. EDIT: Or that seems complete (been a while since I worked on this). @lazd, anything holding up #36? |
|
Closing this, as it's covered in a cleaner way by #36 |
As discussed in #21
A way to write the report to file would be great, especially for reporters like
junitandcheckstyle. I came over https://github.com/juanfran/gulp-scss-lint which writes ti file, but not too cleanly... Other ideas for the API?On a related note, I'd like to pass options in #29, we could put it in there?
EDIT: If you look at the built in formatters (https://github.com/CSSLint/csslint/tree/master/src/formatters) they take an optionshash. Could just use that? I've already added it in the other PR, so for this it's just be the case of reusing that options-hash
/cc @joshuacc