angularjs-automation-readiness
Read-only mining codemod that scans for representative AngularJS patterns and
classifies each match as full, partial, or manual automation, so an
assessment can roll up an automation-readiness score for a codebase (or any
slice of it, e.g. by team or feature module).
Emits the automation_readiness_score metric. Does not modify any files.
Patterns detected
| Automation | Pattern | Notes |
|---|---|---|
full | component-registration | .component(...) registration |
full | simple-ng-directive-string | ng-if/ng-repeat/ng-show/ng-hide/ng-model/ng-class/ng-click/ng-disabled/ng-switch in template strings |
full | $http | $http(...) / $http.get(...) / etc. |
full | $timeout | $timeout(...) / $timeout.cancel(...) |
partial | factory-or-service-registration | .factory(...) / .service(...) |
partial | filter-registration | .filter(...) custom filter definitions |
partial | filter-pipe-usage | {{ value | filterName }} in template strings |
partial | $q | $q(...) / $q.defer() / $q.all(...) / etc. |
partial | $resource | $resource(...) |
partial | ng-include-like-string | ng-include substrings (attribute or templateUrl-style strings) |
manual | directive-with-link-or-compile | a .directive(...) factory whose returned definition object has a link or compile key |
manual | $compile | $compile(...) service usage |
manual | $rootScope.$broadcast | global event bus usage |
manual | jquery-dom-manipulation | bare $(...) calls or angular.element(...) |
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 |
automation | full | partial | manual |
readiness_weight | 1.0 (full) | 0.5 (partial) | 0.0 (manual) — sum/average these to compute a readiness score |
migration_category | component | service | template | directive | scope | dom |
risk | low | medium | high | critical |
effort_points | Fibonacci effort estimate |
recommended_phase | phase-1 .. phase-5 |
Heuristics and known limitations
$http/$timeout/$q/$resource/$compileare matched by identifier
text on the callee (either a bare call, e.g.$timeout(fn, 100), or a
member call whose object is that identifier, e.g.$http.get(...)).
Matching is exact (^\$http$), so lookalikes like$httpBackendor a
locally shadowed variable named$httpare not confused with the real
service — but a locally-scoped variable that happens to be named exactly
$httpwould still be counted (rare in practice for AngularJS DI-style
code).directive-with-link-or-compileonly looks forlink/compileobject
keys inside a.directive(...)call. A directive that merely returns
{ restrict: 'E', template: '...' }with nolink/compileis not
flagged — those are comparatively cheap to port.jquery-dom-manipulationflags the jQuery/jqLite entry point only
($(...)orangular.element(...)), not every chained method call after
it (e.g..css(),.html()), to avoid inflating counts.$rootScope.$broadcastrequires the object to be literally named
$rootScope;$scope.$broadcast(...)(much lower blast radius) is
intentionally not flagged here — seeangularjs-scope-couplingfor
broader$scope/$rootScopecoupling analysis.- String-based detectors (
simple-ng-directive-string,filter-pipe-usage,
ng-include-like-string) scan any string or template literal in the file,
including inline templates. They will not see patterns that only exist in
separate.htmltemplate files (this codemod'sincludeglob is JS/TS
only).
Installation
bash
Development
bash
License
MIT