Mine AngularJS migration effort estimates from matched patterns; read-only metrics
alexbit-codemod·0 executions
mining
metrics
angularjs
code-mining
migration-assessment
migration_effort_score
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.
route-definition — $routeProvider.when(...) or $stateProvider.state(...) call sites.
directive-link — a .directive(...) factory whose returned
definition object has a link key.
directive-compile-fn — a .directive(...) factory whose returned
definition object has a compile key (higher effort than link alone,
since compile implies custom pre-linking/DOM manipulation).
$compile-service — direct usage of the injected $compile service
($compile(...)), independent of any directive definition.
rootscope-event — $rootScope.$broadcast(...), $rootScope.$emit(...), or $rootScope.$on(...).
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 bothlink and compile keys 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 a rootscope-event finding, since that is what
drives cross-cutting migration risk.
Installation
bash
# Install from registry
codemod run angularjs-migration-effort-estimator
# Or run locally
codemod run -w workflow.yaml
Development
bash
# Test the transformation
pnpm test
# Validate the workflow
codemod workflow validate -w workflow.yaml
# Publish to registry
codemod login
codemod publish
License
MIT
Ready to evolve your codebase?
Build tailored, compiler-aware skills to assess, plan, and automate complex codebase changes.