gulp-htmlhint-checkstyle-file-reporter

0.3.0 • Public • Published

gulp-htmlhint-checkstyle-file-reporterjs-standard-style

Writes checkstyle output to a file. This can be used to report gulp-htmlhint results to Jenkins.

Install

$ npm i -D gulp-htmlhint-checkstyle-file-reporter

Usage

var gulp = require('gulp')
var del = require('del')
var vinylPaths = require('vinyl-paths')
var htmlhint = require('gulp-htmlhint')
var concat = require('gulp-concat')
var header = require('gulp-header')
var footer = require('gulp-footer')
 
var REPORT_DIR = 'reports/'
var FILE_NAME = 'htmlhint-checkstyle.xml'
 
// You can specify file name optionally,
// default file name is 'htmlhint-checkstyle.xml'
process.env.HTMLHINT_CHECKSTYLE_FILE = REPORT_DIR + FILE_NAME
 
gulp.task('htmlhint', ['clean'], function () {
  gulp.src('app/**/*.html')
      .pipe(htmlhint('.htmlhintrc'))
      .pipe(htmlhint.reporter('gulp-htmlhint-checkstyle-file-reporter'))
      .pipe(gulp.dest(REPORT_DIR + '.tmp'))
      .on('end', function () {
        gulp.src(REPORT_DIR + '*.tmp.*')
            .pipe(vinylPaths(del))
            .pipe(concat(FILE_NAME))
            .pipe(header('<?xml version="1.0" encoding="utf-8"?>\n<checkstyle version="4.3">\n'))
            .pipe(footer('\n</checkstyle>'))
            .pipe(gulp.dest(REPORT_DIR))
            .on('end', function () {
              del([REPORT_DIR + '.tmp'])
            })
      })
})

Related

License

MIT © Kenichiro Murata

Package Sidebar

Install

npm i gulp-htmlhint-checkstyle-file-reporter

Weekly Downloads

0

Version

0.3.0

License

MIT

Last publish

Collaborators

  • muraken720