diff --git a/src/GitLabHealth-Model-Analysis/GLPTruckFactor.class.st b/src/GitLabHealth-Model-Analysis/GLPTruckFactor.class.st index 9ae6e4b..c9d6b25 100644 --- a/src/GitLabHealth-Model-Analysis/GLPTruckFactor.class.st +++ b/src/GitLabHealth-Model-Analysis/GLPTruckFactor.class.st @@ -95,6 +95,7 @@ GLPTruckFactor >> truckFactor [ numberOfFiles := self blobFiles size. factor := 0. coverage := 1.0. + tfInfo fileAuthorship: authorsMap copy. [ authorsMap isNotEmpty and: [ 0.5 < (self computeCoverageOf: numberOfFiles from: authorsMap) ] ] diff --git a/src/GitLabHealth-Model-Analysis/GLPTruckFactorInfo.class.st b/src/GitLabHealth-Model-Analysis/GLPTruckFactorInfo.class.st index 2382540..62b585d 100644 --- a/src/GitLabHealth-Model-Analysis/GLPTruckFactorInfo.class.st +++ b/src/GitLabHealth-Model-Analysis/GLPTruckFactorInfo.class.st @@ -5,7 +5,8 @@ Class { 'truckFactor', 'totalFiles', 'coverage', - 'developers' + 'developers', + 'fileAuthorship' ], #category : #'GitLabHealth-Model-Analysis-TruckFactor' } @@ -34,6 +35,18 @@ GLPTruckFactorInfo >> developers: anObject [ developers := anObject ] +{ #category : #accessing } +GLPTruckFactorInfo >> fileAuthorship [ + + ^ fileAuthorship +] + +{ #category : #accessing } +GLPTruckFactorInfo >> fileAuthorship: anObject [ + + fileAuthorship := anObject +] + { #category : #initialization } GLPTruckFactorInfo >> initialize [ @@ -41,7 +54,7 @@ GLPTruckFactorInfo >> initialize [ developers := OrderedCollection new ] -{ #category : #initialization } +{ #category : #printing } GLPTruckFactorInfo >> printOn: stream [ stream @@ -63,18 +76,17 @@ GLPTruckFactorInfo >> printOn: stream [ cr. developers do: [ :developer | - | devFiles | - " devFiles := developer authorshipFiles size. -""stream - nextPutAll: repository; - nextPut: $;; - nextPutAll: developer name; - nextPut: $;; - print: ((devFiles asFloat / totalFiles) * 100) roundTo: 0.01; - nextPut: $;; - print: devFiles; - cr" - ]. + stream + nextPutAll: developer name; + nextPut: $;; + print: + ((self fileAuthorship at: developer) size asFloat / totalFiles * 100 + roundTo: 0.01); + nextPut: $;; + print: (self fileAuthorship at: developer) size; + cr + "nextPutAll: repository; + nextPut: $;;" ]. stream ]