Download this file

FieldChurn.rsc    20 lines (18 with data), 760 Bytes

module FieldChurn

import org::ossmeter::metricprovider::Manager;
import org::ossmeter::metricprovider::ProjectDelta;

@metric{fieldChurn}
@doc{fieldChurn}
@friendlyName{fieldChurn}
int getFieldChurn(ProjectDelta delta, map[str, loc] workingCopyFolders, map[str, loc] scratchFolders) {
  int churnCount = 0;
  visit(fieldChurn) {
    case fieldModifierChanged(loc locator, set [Modifier] oldModifiers, set [Modifier] newModifiers): churnCount += 1;
    case fieldTypeChanged(loc locator, _, _): churnCount += 1;
    case fieldDeprecated (loc locator): churnCount += 1;
    case fieldUndeprecated(loc locator): churnCount += 1;
    case addedField(loc locator): churnCount += 1;   
    case deletedField(loc locator): churnCount += 1;
  }
  return churnCount;
}