@@ -18,6 +18,7 @@ define(function (require, exports) {
1818 ProjectManager = brackets . getModule ( "project/ProjectManager" ) ,
1919 StringUtils = brackets . getModule ( "utils/StringUtils" ) ,
2020 Strings = brackets . getModule ( "strings" ) ,
21+ Metrics = brackets . getModule ( "utils/Metrics" ) ,
2122 Constants = require ( "src/Constants" ) ,
2223 Git = require ( "src/git/Git" ) ,
2324 Events = require ( "./Events" ) ,
@@ -87,6 +88,8 @@ define(function (require, exports) {
8788 const compiledTemplate = Mustache . render ( gitCommitDialogTemplate , { Strings : Strings } ) ,
8889 dialog = Dialogs . showModalDialogUsingTemplate ( compiledTemplate ) ,
8990 $dialog = dialog . getElement ( ) ;
91+ Metrics . countEvent ( Metrics . EVENT_TYPE . GIT , 'commit' , "showDialog" ) ;
92+ let totalLintErrors = 0 ;
9093 inspectFiles ( files , $dialog ) . then ( function ( lintResults ) {
9194 // Flatten the error structure from various providers
9295 lintResults = lintResults || [ ] ;
@@ -111,8 +114,11 @@ define(function (require, exports) {
111114 ErrorHandler . logError ( "[brackets-git] lintResults contain object in unexpected format: " + JSON . stringify ( lintResult ) ) ;
112115 }
113116 lintResult . hasErrors = lintResult . errors . length > 0 ;
117+ totalLintErrors += lintResult . errors . length ;
114118 } ) ;
115119
120+ Metrics . countEvent ( Metrics . EVENT_TYPE . GIT , 'commit' , "lintErr" + Metrics . getRangeName ( totalLintErrors ) ) ;
121+
116122 // Filter out only results with errors to show
117123 lintResults = _ . filter ( lintResults , function ( lintResult ) {
118124 return lintResult . hasErrors ;
@@ -152,7 +158,11 @@ define(function (require, exports) {
152158 _makeDialogBig ( $dialog ) ;
153159
154160 // Show nicely colored commit diff
155- $dialog . find ( ".commit-diff" ) . append ( Utils . formatDiff ( stagedDiff ) ) ;
161+ const diff = Utils . formatDiff ( stagedDiff ) ;
162+ if ( diff === Utils . FORMAT_DIFF_TOO_LARGE ) {
163+ Metrics . countEvent ( Metrics . EVENT_TYPE . GIT , 'commit' , "diffTooLarge" ) ;
164+ }
165+ $dialog . find ( ".commit-diff" ) . append ( diff ) ;
156166
157167 // Enable / Disable amend checkbox
158168 var toggleAmendCheckbox = function ( bool ) {
@@ -343,8 +353,10 @@ define(function (require, exports) {
343353 }
344354
345355 ErrorHandler . showError ( err , Strings . ERROR_GIT_COMMIT_FAILED ) ;
356+ Metrics . countEvent ( Metrics . EVENT_TYPE . GIT , 'commit' , "fail" ) ;
346357
347358 } ) . finally ( function ( ) {
359+ Metrics . countEvent ( Metrics . EVENT_TYPE . GIT , 'commit' , "success" ) ;
348360 EventEmitter . emit ( Events . GIT_COMMITED ) ;
349361 refresh ( ) ;
350362 } ) ;
@@ -599,8 +611,8 @@ define(function (require, exports) {
599611 function inspectFiles ( gitStatusResults , $dialog ) {
600612 const lintResults = [ ] ;
601613 let totalFiles = gitStatusResults . length ,
614+ totalFilesLinted = 0 ,
602615 filesDone = 0 ;
603-
604616 function showProgress ( ) {
605617 const $progressBar = $dialog . find ( '.accordion-progress-bar-inner' ) ;
606618 if ( $progressBar . length ) {
@@ -651,13 +663,16 @@ define(function (require, exports) {
651663 resolve ( ) ;
652664 } ) . finally ( ( ) => {
653665 filesDone ++ ;
666+ totalFilesLinted ++ ;
654667 showProgress ( ) ;
655668 } ) ;
656669 } , 0 ) ; // Delay of 0ms to defer to the next tick of the event loop
657670 } ) ;
658671 } ) ;
659672
660673 return Promise . all ( _ . compact ( codeInspectionPromises ) ) . then ( function ( ) {
674+ Metrics . countEvent ( Metrics . EVENT_TYPE . GIT , 'commit' , "files" + Metrics . getRangeName ( totalFiles ) ) ;
675+ Metrics . countEvent ( Metrics . EVENT_TYPE . GIT , 'commit' , "lint" + Metrics . getRangeName ( totalFilesLinted ) ) ;
661676 return lintResults ;
662677 } ) ;
663678 }
0 commit comments