function checkFormat()

in index.js [49:80]


function checkFormat(opt_clangOptions, opt_clangFormat, opt_gulpOptions) {
  var optsStr = getOptsString(opt_clangOptions);
  var actualClangFormat = opt_clangFormat || clangFormat;
  opt_gulpOptions = opt_gulpOptions || {};

  var filePaths = [];
  var pipe = combine.obj(format(opt_clangOptions, opt_clangFormat), diff());
  if (opt_gulpOptions.verbose) {
    pipe = combine.obj(pipe, diff.reporter({fail: false}));
  }
  pipe = combine.obj(
      pipe,
      through2({objectMode: true},
               function(f, enc, done) {
                 if (f.diff && Object.keys(f.diff).length) filePaths.push(path.relative(process.cwd(), f.path));
                 done(null, f);
               },
               function(done) {
                 if (filePaths.length) {
                   var clangFormatBin = path.relative(process.cwd(), actualClangFormat.location);
                   log('WARNING: Files are not properly formatted. Please run');
                   log('  ' + clangFormatBin + ' -i -style="' + optsStr + '" ' +
                             filePaths.join(' '));
                   log('  (using clang-format version ' + actualClangFormat.version + ')');
                   var level = opt_gulpOptions.fail ? 'error' : 'warning';
                   pipe.emit(level,
                             new PluginError('gulp-clang-format', 'files not formatted'));
                 }
                 done();
               }));
  return pipe;
}