index.js
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;
}
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;
}
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 ; }
Verifies that files are already in the format produced by clang-format.
Prints a warning to the console for any file which isn't formatted.

@param {(string|Object)=} opt_clangOptions the string 'file' to search for a
'.clang-format' file, or an object literal containing clang-format options
http://clang.llvm.org/docs/ClangFormatStyleOptions.html#configurable-format-style-options
@param {Object=} opt_clangFormat A clang-format module to optionally use.
@param {Object=} opt_gulpOptions Options for the gulp process. Options are
'verbose', which toggles a verbose diff report.
'fail', whether to fail in case of a diff.
Verifies that files are already in the format produced by clang - format . Prints a warning to the console for any file which isn t formatted .