angularjs-migration-effort-estimator
Read-only mining codemod that detects AngularJS constructs and assigns each
one a Fibonacci effort estimate, a rough hours-per-occurrence heuristic, and
a recommended migration phase, so an assessment can roll up a total
migration-effort score for a codebase (or any slice of it).
Emits the migration_effort_score metric. Does not modify any files.
Patterns detected
| Pattern | Effort points | Estimated hours | Phase | Category |
|---|---|---|---|---|
module-or-component | 2 | 4-8h | phase-3 | component |
service-or-factory | 3 | 8-16h | phase-2 | service |
route-definition | 5 | 16-24h | phase-4 | routing |
directive-link | 8 | 24-40h | phase-4 | directive |
rootscope-event | 8 | 24-40h | phase-2 | scope |
directive-compile-fn | 13 | 40-64h | phase-5 | directive |
$compile-service | 13 | 40-64h | phase-5 | directive |
Detection rules:
module-or-component—angular.module(...)/.component(...)
registration call sites.service-or-factory—.service(...)/.factory(...)registration
call sites.route-definition—$routeProvider.when(...)or
$stateProvider.state(...)call sites.directive-link— a.directive(...)factory whose returned
definition object has alinkkey.directive-compile-fn— a.directive(...)factory whose returned
definition object has acompilekey (higher effort thanlinkalone,
sincecompileimplies custom pre-linking/DOM manipulation).$compile-service— direct usage of the injected$compileservice
($compile(...)), independent of any directive definition.rootscope-event—$rootScope.$broadcast(...),
$rootScope.$emit(...), or$rootScope.$on(...).
Cardinalities
| Field | Description |
|---|---|
file | Relative file path |
line | 1-based line number of the match |
snippet | Truncated source snippet (whitespace-collapsed, 120 chars) |
pattern | One of the pattern names above |
effort_points | Fibonacci estimate: 1, 2, 3, 5, 8, or 13 |
estimated_hours | Rough hours-per-occurrence heuristic string (e.g. "24-40h") |
recommended_phase | phase-1 .. phase-5 |
migration_category | component | service | routing | directive | scope |
risk | low | medium | high | critical |
automation | full | partial | manual |
estimated_hours is a per-occurrence heuristic, not a file- or
project-level estimate — sum effort_points (or midpoints of
estimated_hours) across all findings during assessment roll-up.
Known limitations
- A
.directive(...)with bothlinkandcompilekeys produces two
separate findings (directive-linkanddirective-compile-fn) — this
is intentional, since each concern carries its own migration cost, but it
means directive effort is not a single number per directive. - Object-identifier matching is exact (
$routeProvider,$stateProvider,
$rootScope,$compile), so a locally scoped variable with an unrelated
purpose but an identical name would still be counted — this is rare in
idiomatic AngularJS DI-driven code but worth spot-checking in unusual
codebases. $scope.$broadcast(...)/$scope.$on(...)(scoped, not global) are
intentionally not counted here — only$rootScope-rooted event bus
usage is treated as arootscope-eventfinding, since that is what
drives cross-cutting migration risk.
Installation
bash
Development
bash
License
MIT