@@ -16,7 +16,6 @@ module.exports = function (options) {
1616
1717 options = assign ( { esnext : false } , options ) ;
1818
19- var out = [ ] ;
2019 var checker = new Checker ( { esnext : ! ! options . esnext } ) ;
2120
2221 checker . registerDefaultRules ( ) ;
@@ -59,48 +58,34 @@ module.exports = function (options) {
5958 return ;
6059 }
6160
62- try {
63- var fixResults ;
64- var errors ;
65- var contents = file . contents . toString ( ) ;
66-
67- if ( shouldFix ) {
68- fixResults = checker . fixString ( contents , file . relative ) ;
69- errors = fixResults . errors ;
70- file . contents = new Buffer ( fixResults . output ) ;
71- } else {
72- errors = checker . checkString ( contents , file . relative ) ;
73- }
74-
75- var errorList = errors . getErrorList ( ) ;
76-
77- file . jscs = {
78- success : true ,
79- errorCount : 0 ,
80- errors : [ ]
81- } ;
82-
83- if ( errorList . length > 0 ) {
84- file . jscs . success = false ;
85- file . jscs . errorCount = errorList . length ;
86- file . jscs . errors = errorList ;
87- }
88-
89- errorList . forEach ( function ( err ) {
90- out . push ( errors . explainError ( err , true ) ) ;
91- } ) ;
92- } catch ( err ) {
93- out . push ( err . stack . replace ( 'null:' , file . relative + ':' ) ) ;
61+ var fixResults ;
62+ var errors ;
63+ var contents = file . contents . toString ( ) ;
64+
65+ if ( shouldFix ) {
66+ fixResults = checker . fixString ( contents , file . relative ) ;
67+ errors = fixResults . errors ;
68+ file . contents = new Buffer ( fixResults . output ) ;
69+ } else {
70+ errors = checker . checkString ( contents , file . relative ) ;
9471 }
9572
96- cb ( null , file ) ;
97- } , function ( cb ) {
98- if ( out . length > 0 ) {
99- this . emit ( 'error' , new gutil . PluginError ( 'gulp-jscs' , out . join ( '\n\n' ) , {
100- showStack : false
101- } ) ) ;
73+ var errorList = errors . getErrorList ( ) ;
74+
75+ file . jscs = {
76+ success : true ,
77+ errorCount : 0 ,
78+ errors : [ ]
79+ } ;
80+
81+ if ( errorList . length > 0 ) {
82+ file . jscs . success = false ;
83+ file . jscs . errorCount = errorList . length ;
84+ file . jscs . errors = errors ;
10285 }
10386
104- cb ( ) ;
87+ cb ( null , file ) ;
10588 } ) ;
10689} ;
90+
91+ module . exports . reporter = require ( './reporters' ) ;
0 commit comments