@@ -601,54 +601,60 @@ define(function (require, exports) {
601601 let totalFiles = gitStatusResults . length ,
602602 filesDone = 0 ;
603603
604+ function showProgress ( ) {
605+ const $progressBar = $dialog . find ( '.accordion-progress-bar-inner' ) ;
606+ if ( $progressBar . length ) {
607+ $progressBar [ 0 ] . style . width = `${ filesDone / totalFiles * 100 } %` ;
608+ }
609+ if ( filesDone === totalFiles ) {
610+ $dialog . find ( '.accordion-progress-bar' ) . addClass ( "forced-inVisible" ) ;
611+ }
612+ const progressString = StringUtils . format ( Strings . CODE_INSPECTION_DONE_FILES , filesDone , totalFiles ) ;
613+ $dialog . find ( ".lint-errors" ) . html ( progressString ) ;
614+ }
615+
604616 const codeInspectionPromises = gitStatusResults . map ( function ( fileObj ) {
605617 const isDeleted = fileObj . status . indexOf ( Git . FILE_STATUS . DELETED ) !== - 1 ;
618+ if ( isDeleted ) {
619+ filesDone ++ ;
620+ showProgress ( ) ;
621+ return ;
622+ }
606623
607624 // Do a code inspection for the file, if it was not deleted
608- if ( ! isDeleted ) {
609- return new Promise ( ( resolve ) => {
610- // Delay lintFile execution to give the event loop some breathing room
611- setTimeout ( ( ) => {
612- lintFile ( fileObj . file )
613- . catch ( function ( ) {
614- return [
615- {
616- provider : { name : "See console [F12] for details" } ,
617- result : {
618- errors : [
619- {
620- pos : { line : 0 , ch : 0 } ,
621- message : "CodeInspection failed to execute for this file."
622- }
623- ]
624- }
625+ return new Promise ( ( resolve ) => {
626+ // Delay lintFile execution to give the event loop some breathing room
627+ setTimeout ( ( ) => {
628+ lintFile ( fileObj . file )
629+ . catch ( function ( ) {
630+ return [
631+ {
632+ provider : { name : "See console [F12] for details" } ,
633+ result : {
634+ errors : [
635+ {
636+ pos : { line : 0 , ch : 0 } ,
637+ message : "CodeInspection failed to execute for this file."
638+ }
639+ ]
625640 }
626- ] ;
627- } )
628- . then ( function ( result ) {
629- if ( result ) {
630- lintResults . push ( {
631- filename : fileObj . file ,
632- result : result
633- } ) ;
634- }
635- resolve ( ) ;
636- } ) . finally ( ( ) => {
637- filesDone ++ ;
638- const $progressBar = $dialog . find ( '.accordion-progress-bar-inner' ) ;
639- if ( $progressBar . length ) {
640- $progressBar [ 0 ] . style . width = `${ filesDone / totalFiles * 100 } %` ;
641- }
642- if ( filesDone === totalFiles ) {
643- $dialog . find ( '.accordion-progress-bar' ) . addClass ( "forced-inVisible" ) ;
644641 }
645- const progressString = StringUtils . format ( Strings . CODE_INSPECTION_DONE_FILES , filesDone , totalFiles ) ;
646- $dialog . find ( ".lint-errors" ) . html ( progressString ) ;
647-
648- } ) ;
649- } , 0 ) ; // Delay of 0ms to defer to the next tick of the event loop
650- } ) ;
651- }
642+ ] ;
643+ } )
644+ . then ( function ( result ) {
645+ if ( result ) {
646+ lintResults . push ( {
647+ filename : fileObj . file ,
648+ result : result
649+ } ) ;
650+ }
651+ resolve ( ) ;
652+ } ) . finally ( ( ) => {
653+ filesDone ++ ;
654+ showProgress ( ) ;
655+ } ) ;
656+ } , 0 ) ; // Delay of 0ms to defer to the next tick of the event loop
657+ } ) ;
652658 } ) ;
653659
654660 return Promise . all ( _ . compact ( codeInspectionPromises ) ) . then ( function ( ) {
0 commit comments