angularjs-scope-coupling
Read-only mining codemod that scans AngularJS JavaScript source for $scope/$rootScope
coupling and emits a scope_coupling metric for migration assessment. It never modifies
files — every match is reported via codemod:metrics and the transform always returns null.
What it detects
- Bare
$scope/$rootScopereferences (DI parameters, arguments, generic property access) $watch,$watchCollection,$watchGroup$on,$broadcast,$emit— flagged high risk when bound to$rootScope(global event
bus coupling), medium risk on plain$scope$apply,$applyAsync,$digest,$evalAsync— safe to drop under Angular's zone-based
change detection, so these are fully automatable
Metric cardinality
Each finding increments scope_coupling with:
ts
Installation
bash
Development
bash
License
MIT