@@ -74,19 +74,6 @@ const tslintFilter = [
7474 '!**/*.d.ts'
7575] ;
7676
77- const copyrightHeader = [
78- '// Copyright (c) Microsoft Corporation. All rights reserved.' ,
79- '// Licensed under the MIT License.' ,
80- '' ,
81- '\'use strict\';'
82- ] ;
83- const copyrightHeaderNoSpace = [
84- '// Copyright (c) Microsoft Corporation. All rights reserved.' ,
85- '// Licensed under the MIT License.' ,
86- '\'use strict\';'
87- ] ;
88- const copyrightHeaders = [ copyrightHeader . join ( '\n' ) , copyrightHeader . join ( '\r\n' ) , copyrightHeaderNoSpace . join ( '\n' ) , copyrightHeaderNoSpace . join ( '\r\n' ) ] ;
89-
9077gulp . task ( 'precommit' , ( done ) => run ( { exitOnError : true , mode : 'staged' } , done ) ) ;
9178
9279gulp . task ( 'hygiene-watch' , ( ) => gulp . watch ( tsFilter , gulp . series ( 'hygiene-modified' ) ) ) ;
@@ -274,7 +261,6 @@ function buildDebugAdapterCoverage(done) {
274261* @property {'changes'|'staged'|'all'|'compile'|'diffMaster' } [mode=] - Mode.
275262* @property {boolean= } skipIndentationCheck - Skip indentation checks.
276263* @property {boolean= } skipFormatCheck - Skip format checks.
277- * @property {boolean= } skipCopyrightCheck - Skip copyright checks.
278264* @property {boolean= } skipLinter - Skip linter.
279265*/
280266
@@ -322,19 +308,6 @@ const hygiene = (options, done) => {
322308 compilationInProgress = true ;
323309 options = options || { } ;
324310 let errorCount = 0 ;
325- const addedFiles = options . skipCopyrightCheck ? [ ] : getAddedFilesSync ( ) ;
326- const copyrights = es . through ( function ( file ) {
327- if ( addedFiles . indexOf ( file . path ) !== - 1 ) {
328- const contents = file . contents . toString ( 'utf8' ) ;
329- if ( ! copyrightHeaders . some ( header => contents . indexOf ( header ) === 0 ) ) {
330- // Use tslint format.
331- console . error ( `ERROR: (copyright) ${ file . relative } [1,1]: Missing or bad copyright statement` ) ;
332- errorCount ++ ;
333- }
334- }
335-
336- this . emit ( 'data' , file ) ;
337- } ) ;
338311
339312 const indentation = es . through ( function ( file ) {
340313 file . contents
@@ -479,10 +452,6 @@ const hygiene = (options, done) => {
479452 result = result
480453 . pipe ( filter ( tslintFilter ) ) ;
481454
482- if ( ! options . skipCopyrightCheck ) {
483- result = result . pipe ( copyrights ) ;
484- }
485-
486455 if ( ! options . skipFormatCheck ) {
487456 // result = result
488457 // .pipe(formatting);
@@ -548,7 +517,6 @@ const hygiene = (options, done) => {
548517* @property {string[]= } files - Optional list of files to be modified.
549518* @property {boolean= } skipIndentationCheck - Skip indentation checks.
550519* @property {boolean= } skipFormatCheck - Skip format checks.
551- * @property {boolean= } skipCopyrightCheck - Skip copyright checks.
552520* @property {boolean= } skipLinter - Skip linter.
553521 * @property {boolean= } watch - Watch mode.
554522*/
@@ -693,14 +661,7 @@ function getFileListToProcess(options) {
693661
694662exports . hygiene = hygiene ;
695663
696- // // this allows us to run hygiene via CLI (e.g. `node gulfile.js`).
697- // if (require.main === module) {
698- // const args = process.argv0.length > 2 ? process.argv.slice(2) : [];
699- // const isPreCommit = args.findIndex(arg => arg.startsWith('precommit='));
700- // const performPreCommitCheck = isPreCommit >= 0 ? args[isPreCommit].split('=')[1].trim().toUpperCase().startsWith('T') : false;
701- // // Allow precommit hooks for those with a file `./out/precommit.hook`.
702- // if (args.length > 0 && (!performPreCommitCheck || !fs.existsSync(path.join(__dirname, 'precommit.hook')))) {
703- // return;
704- // }
705- // run({ exitOnError: true, mode: 'staged' }, () => { });
706- // }
664+ // this allows us to run hygiene via CLI (e.g. `node gulfile.js`).
665+ if ( require . main === module ) {
666+ run ( { exitOnError : true , mode : 'staged' } , ( ) => { } ) ;
667+ }
0 commit comments