@@ -2,6 +2,7 @@ var gonzales = require('gonzales');
22var minimatch = require ( 'minimatch' ) ;
33var vow = require ( 'vow' ) ;
44var vfs = require ( 'vow-fs' ) ;
5+ var doNothing = function ( ) { } ;
56
67/**
78 * Starts Code Style processing process.
@@ -56,8 +57,10 @@ Comb.prototype = {
5657 } ) ;
5758
5859 this . processed = 0 ;
60+ this . tbchanged = 0 ;
5961 this . changed = 0 ;
6062 this . _verbose = config . verbose ;
63+ this . _lint = config . lint ;
6164 } ,
6265
6366 /**
@@ -125,11 +128,22 @@ Comb.prototype = {
125128 return vfs . read ( path , 'utf8' ) . then ( function ( data ) {
126129 var processedData = _this . processString ( data , path ) ;
127130 var changed = data !== processedData ;
128- return vfs . write ( path , processedData , 'utf8' ) . then ( function ( ) {
129- _this . processed ++ ;
130- if ( changed ) _this . changed ++ ;
131- if ( _this . _verbose ) console . log ( ( changed ? '✓' : ' ' ) + ' ' + path ) ;
132- } ) ;
131+ var lint = _this . _lint ;
132+
133+ var tick = changed ? ( lint ? '!' : '✓' ) : ' ' ;
134+ var message = _this . _verbose ? console . log . bind ( null , tick , path ) : doNothing ;
135+
136+ _this . processed ++ ;
137+ changed && _this . tbchanged ++ ;
138+
139+ if ( ! changed || lint ) {
140+ message ( ) ;
141+ } else {
142+ return vfs . write ( path , processedData , 'utf8' ) . then ( function ( ) {
143+ _this . changed ++ ;
144+ message ( ) ;
145+ } ) ;
146+ }
133147 } ) ;
134148 }
135149 return null ;
0 commit comments