@@ -99,10 +99,14 @@ gulp.task('debugger-coverage', () => buildDebugAdapterCoverage());
99
99
100
100
gulp . task ( 'hygiene-watch' , ( ) => gulp . watch ( tsFilter , debounce ( ( ) => run ( { mode : 'changes' , skipFormatCheck : true , skipIndentationCheck : true , skipCopyrightCheck : true } ) , 100 ) ) ) ;
101
101
102
+ gulp . task ( 'hygiene-watch-branch' , ( ) => gulp . watch ( tsFilter , debounce ( ( ) => run ( { mode : 'diffMaster' , skipFormatCheck : true , skipIndentationCheck : true , skipCopyrightCheck : true } ) , 100 ) ) ) ;
103
+
102
104
gulp . task ( 'hygiene-all' , ( ) => run ( { mode : 'all' } ) ) ;
103
105
104
106
gulp . task ( 'hygiene-modified' , [ 'compile' ] , ( ) => run ( { mode : 'changes' } ) ) ;
105
107
108
+ gulp . task ( 'hygiene-branch' , [ 'compile' ] , ( ) => run ( { mode : 'diffMaster' } ) ) ;
109
+
106
110
gulp . task ( 'clean' , [ 'output:clean' , 'cover:clean' ] , ( ) => { } ) ;
107
111
108
112
gulp . task ( 'output:clean' , ( ) => del ( [ 'coverage' , 'debug_coverage*' ] ) ) ;
@@ -266,7 +270,7 @@ function buildDebugAdapterCoverage() {
266
270
267
271
/**
268
272
* @typedef {Object } hygieneOptions - creates a new type named 'SpecialType'
269
- * @property {'changes'|'staged'|'all'|'compile' } [mode=] - Mode.
273
+ * @property {'changes'|'staged'|'all'|'compile'|'diffMaster' } [mode=] - Mode.
270
274
* @property {boolean= } skipIndentationCheck - Skip indentation checks.
271
275
* @property {boolean= } skipFormatCheck - Skip format checks.
272
276
* @property {boolean= } skipCopyrightCheck - Skip copyright checks.
@@ -590,6 +594,13 @@ function getModifiedFilesSync() {
590
594
. filter ( l => _ . intersection ( [ 'M' , 'A' , 'R' , 'C' , 'U' , '?' ] , l . substring ( 0 , 2 ) . trim ( ) . split ( '' ) ) . length > 0 )
591
595
. map ( l => path . join ( __dirname , l . substring ( 2 ) . trim ( ) ) ) ;
592
596
}
597
+ function getDifferentFromMasterFilesSync ( ) {
598
+ const out = cp . execSync ( 'git diff --name-status master' , { encoding : 'utf8' } ) ;
599
+ return out
600
+ . split ( / \r ? \n / )
601
+ . filter ( l => ! ! l )
602
+ . map ( l => path . join ( __dirname , l . substring ( 2 ) . trim ( ) ) ) ;
603
+ }
593
604
594
605
/**
595
606
* @param {hygieneOptions } options
@@ -615,6 +626,10 @@ function getFileListToProcess(options) {
615
626
return getStagedFilesSync ( ) ;
616
627
}
617
628
629
+ if ( options && options . mode === 'diffMaster' ) {
630
+ return getDifferentFromMasterFilesSync ( ) ;
631
+ }
632
+
618
633
return all ;
619
634
}
620
635
exports . hygiene = hygiene ;
0 commit comments