Parent:
[fb10d8]
(diff)
Child:
[6abef3]
(diff)
Download this file
Churn.rsc
21 lines (18 with data), 641 Bytes
module Churn
import org::ossmeter::metricprovider::Manager;
import org::ossmeter::metricprovider::ProjectDelta;
@metric{churnPerCommit}
@doc{Count churn}
@friendlyName{Counts number of lines added and deleted per commit}
@appliesTo{generic()}
map[loc, int] churnPerCommit(ProjectDelta delta = \empty()) {
map[loc, int] result = ();
for (/VcsRepositoryDelta vcsDelta := delta) {
result += (vcsDelta.repository.url + co.revision : churn(co) | /VcsCommit co := vcsDelta);
}
return result;
}
int churn(VcsCommit item)
= (0 | it + count | /linesAdded(count) := item)
+ (0 | it + count | /linesDeleted(count) := item)
;